mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-25 06:46:10 +02:00
updated REST API and MQTT to use the same functionality
added heap as MQTT publish updated User_Manual.md to latest changes development build will have now always the same name because of static link from https://ahoydtu.de
This commit is contained in:
parent
573bd31f0a
commit
b1946df32f
13 changed files with 272 additions and 350 deletions
16
src/app.cpp
16
src/app.cpp
|
@ -12,6 +12,12 @@
|
|||
#include <ArduinoJson.h>
|
||||
#include "utils/sun.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
app::app() : ah::Scheduler() {
|
||||
mWeb = NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::setup(uint32_t timeout) {
|
||||
Serial.begin(115200);
|
||||
|
@ -39,7 +45,6 @@ void app::setup(uint32_t timeout) {
|
|||
mWifi = new ahoywifi(mConfig);
|
||||
mWifi->setup(timeout, mSettings.getValid());
|
||||
|
||||
|
||||
mPayload.setup(mSys);
|
||||
mPayload.enableSerialDebug(mConfig->serial.debug);
|
||||
#if !defined(AP_ONLY)
|
||||
|
@ -48,6 +53,7 @@ void app::setup(uint32_t timeout) {
|
|||
addListener(EVERY_SEC, std::bind(&PubMqttType::tickerSecond, &mMqtt));
|
||||
addListener(EVERY_MIN, std::bind(&PubMqttType::tickerMinute, &mMqtt));
|
||||
addListener(EVERY_HR, std::bind(&PubMqttType::tickerHour, &mMqtt));
|
||||
mMqtt.setSubscriptionCb(std::bind(&app::mqttSubRxCb, this, std::placeholders::_1));
|
||||
}
|
||||
#endif
|
||||
setupLed();
|
||||
|
@ -226,8 +232,6 @@ void app::resetSystem(void) {
|
|||
mSunrise = 0;
|
||||
mSunset = 0;
|
||||
|
||||
mHeapStatCnt = 0;
|
||||
|
||||
mSendTicker = 0xffff;
|
||||
|
||||
mTicker = 0;
|
||||
|
@ -240,6 +244,12 @@ void app::resetSystem(void) {
|
|||
memset(&mStat, 0, sizeof(statistics_t));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::mqttSubRxCb(JsonObject obj) {
|
||||
if(NULL != mWeb)
|
||||
mWeb->apiCtrlRequest(obj);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::setupLed(void) {
|
||||
/** LED connection diagram
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue