|
@ -18,10 +18,8 @@ |
|
|
#include "config/settings.h" |
|
|
#include "config/settings.h" |
|
|
#include "defines.h" |
|
|
#include "defines.h" |
|
|
#include "utils/crc.h" |
|
|
#include "utils/crc.h" |
|
|
#include "utils/ahoyTimer.h" |
|
|
|
|
|
#include "utils/scheduler.h" |
|
|
#include "utils/scheduler.h" |
|
|
|
|
|
|
|
|
#include "hm/CircularBuffer.h" |
|
|
|
|
|
#include "hm/hmSystem.h" |
|
|
#include "hm/hmSystem.h" |
|
|
#include "hm/payload.h" |
|
|
#include "hm/payload.h" |
|
|
#include "wifi/ahoywifi.h" |
|
|
#include "wifi/ahoywifi.h" |
|
@ -61,10 +59,6 @@ class app : public IApp, public ah::Scheduler { |
|
|
void loopWifi(void); |
|
|
void loopWifi(void); |
|
|
void onWifi(bool gotIp); |
|
|
void onWifi(bool gotIp); |
|
|
void regularTickers(void); |
|
|
void regularTickers(void); |
|
|
void handleIntr(void); |
|
|
|
|
|
void cbMqtt(char* topic, byte* payload, unsigned int length); |
|
|
|
|
|
void saveValues(void); |
|
|
|
|
|
bool getWifiApActive(void); |
|
|
|
|
|
|
|
|
|
|
|
uint32_t getUptime() { |
|
|
uint32_t getUptime() { |
|
|
return Scheduler::getUptime(); |
|
|
return Scheduler::getUptime(); |
|
@ -99,6 +93,10 @@ class app : public IApp, public ah::Scheduler { |
|
|
mWifi.getAvailNetworks(obj); |
|
|
mWifi.getAvailNetworks(obj); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setOnUpdate() { |
|
|
|
|
|
onWifi(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void setRebootFlag() { |
|
|
void setRebootFlag() { |
|
|
once(std::bind(&app::tickReboot, this), 3, "rboot"); |
|
|
once(std::bind(&app::tickReboot, this), 3, "rboot"); |
|
|
} |
|
|
} |
|
@ -206,6 +204,9 @@ class app : public IApp, public ah::Scheduler { |
|
|
|
|
|
|
|
|
void tickReboot(void) { |
|
|
void tickReboot(void) { |
|
|
DPRINTLN(DBG_INFO, F("Rebooting...")); |
|
|
DPRINTLN(DBG_INFO, F("Rebooting...")); |
|
|
|
|
|
onWifi(false); |
|
|
|
|
|
ah::Scheduler::resetTicker(); |
|
|
|
|
|
WiFi.disconnect(); |
|
|
ESP.restart(); |
|
|
ESP.restart(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -247,13 +248,9 @@ class app : public IApp, public ah::Scheduler { |
|
|
settings_t *mConfig; |
|
|
settings_t *mConfig; |
|
|
|
|
|
|
|
|
uint8_t mSendLastIvId; |
|
|
uint8_t mSendLastIvId; |
|
|
uint8_t mSendTickerId; |
|
|
|
|
|
|
|
|
|
|
|
statistics_t mStat; |
|
|
statistics_t mStat; |
|
|
|
|
|
|
|
|
// timer
|
|
|
|
|
|
uint32_t mRxTicker; |
|
|
|
|
|
|
|
|
|
|
|
// mqtt
|
|
|
// mqtt
|
|
|
PubMqttType mMqtt; |
|
|
PubMqttType mMqtt; |
|
|
bool mMqttReconnect; |
|
|
bool mMqttReconnect; |
|
|