mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-28 17:56:21 +02:00
0.8.107
* fix boot loop on `reboot on midnight` feature #1542, #1599, #1566, #1571
This commit is contained in:
parent
435aa1748a
commit
12b4251da9
6 changed files with 34 additions and 35 deletions
|
@ -1,5 +1,8 @@
|
|||
# Development Changes
|
||||
|
||||
## 0.8.107 - 2024-04-08
|
||||
* fix boot loop on `reboot on midnight` feature #1542, #1599, #1566, #1571
|
||||
|
||||
## 0.8.106 - 2024-04-05
|
||||
* fix bootloop with CMT and NRF on ESP32 #1566 #1562
|
||||
* possible fix of #1553
|
||||
|
|
58
src/app.cpp
58
src/app.cpp
|
@ -162,7 +162,7 @@ void app::onNetwork(bool gotIp) {
|
|||
ah::Scheduler::resetTicker();
|
||||
regularTickers(); //reinstall regular tickers
|
||||
every(std::bind(&app::tickSend, this), mConfig->inst.sendInterval, "tSend");
|
||||
mMqttReconnect = true;
|
||||
mTickerInstallOnce = true;
|
||||
mSunrise = 0; // needs to be set to 0, to reinstall sunrise and ivComm tickers!
|
||||
once(std::bind(&app::tickNtpUpdate, this), 2, "ntp2");
|
||||
}
|
||||
|
@ -200,40 +200,37 @@ void app::onNtpUpdate(bool gotTime) {
|
|||
mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600;
|
||||
tickCalcSunrise();
|
||||
}
|
||||
|
||||
if (mTickerInstallOnce) {
|
||||
mTickerInstallOnce = false;
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttEnabled) {
|
||||
mMqtt.tickerSecond();
|
||||
everySec(std::bind(&PubMqttType::tickerSecond, &mMqtt), "mqttS");
|
||||
everyMin(std::bind(&PubMqttType::tickerMinute, &mMqtt), "mqttM");
|
||||
}
|
||||
#endif /*ENABLE_MQTT*/
|
||||
|
||||
if (mConfig->inst.rstValsNotAvail)
|
||||
everyMin(std::bind(&app::tickMinute, this), "tMin");
|
||||
|
||||
if(mNtpReceived) {
|
||||
uint32_t localTime = gTimezone.toLocal(mTimestamp);
|
||||
uint32_t midTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time
|
||||
onceAt(std::bind(&app::tickMidnight, this), midTrig, "midNi");
|
||||
|
||||
if (mConfig->sys.schedReboot) {
|
||||
uint32_t rebootTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86410); // reboot 10 secs after midnght
|
||||
onceAt(std::bind(&app::tickReboot, this), rebootTrig, "midRe");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::updateNtp(void) {
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttReconnect && mMqttEnabled) {
|
||||
mMqtt.tickerSecond();
|
||||
everySec(std::bind(&PubMqttType::tickerSecond, &mMqtt), "mqttS");
|
||||
everyMin(std::bind(&PubMqttType::tickerMinute, &mMqtt), "mqttM");
|
||||
}
|
||||
#endif /*ENABLE_MQTT*/
|
||||
|
||||
// only install schedulers once even if NTP wasn't successful in first loop
|
||||
if (mMqttReconnect) { // @TODO: mMqttReconnect is variable which scope has changed
|
||||
if (mConfig->inst.rstValsNotAvail)
|
||||
everyMin(std::bind(&app::tickMinute, this), "tMin");
|
||||
|
||||
uint32_t localTime = gTimezone.toLocal(mTimestamp);
|
||||
uint32_t midTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time
|
||||
onceAt(std::bind(&app::tickMidnight, this), midTrig, "midNi");
|
||||
|
||||
if (mConfig->sys.schedReboot) {
|
||||
uint32_t rebootTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86410); // reboot 10 secs after midnght
|
||||
if (rebootTrig <= mTimestamp) { //necessary for times other than midnight to prevent reboot loop
|
||||
rebootTrig += 86400;
|
||||
}
|
||||
onceAt(std::bind(&app::tickReboot, this), rebootTrig, "midRe");
|
||||
}
|
||||
}
|
||||
|
||||
if(mNtpReceived)
|
||||
onNtpUpdate(true);
|
||||
|
||||
mMqttReconnect = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -249,8 +246,6 @@ void app::tickNtpUpdate(void) {
|
|||
|
||||
updateNtp();
|
||||
|
||||
mMqttReconnect = false;
|
||||
|
||||
once(std::bind(&app::tickNtpUpdate, this), nxtTrig, "ntp");
|
||||
}
|
||||
|
||||
|
@ -548,6 +543,7 @@ void app::resetSystem(void) {
|
|||
|
||||
mNetworkConnected = false;
|
||||
mNtpReceived = false;
|
||||
mTickerInstallOnce = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -447,7 +447,7 @@ class app : public IApp, public ah::Scheduler {
|
|||
#if defined(ENABLE_MQTT)
|
||||
PubMqttType mMqtt;
|
||||
#endif /*ENABLE_MQTT*/
|
||||
bool mMqttReconnect = false;
|
||||
bool mTickerInstallOnce = false;
|
||||
bool mMqttEnabled = false;
|
||||
|
||||
// sun
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 106
|
||||
#define VERSION_PATCH 107
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
uint8_t ch;
|
||||
|
|
|
@ -301,7 +301,7 @@ build_flags = ${env.build_flags}
|
|||
-DDEF_LED1=17
|
||||
-DLED_ACTIVE_HIGH
|
||||
-DARDUINO_USB_MODE=1
|
||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
monitor_filters =
|
||||
esp32_exception_decoder, colorize
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
{
|
||||
"token": "TRY_TO_CONNECT",
|
||||
"en": "AhoyDTU is trying to connect to your WiFi",
|
||||
"de": "AhoyDTU versucht eine Verindung mit deinem Netzwerk herzustellen"
|
||||
"de": "AhoyDTU versucht eine Verbindung mit Deinem Netzwerk herzustellen"
|
||||
},
|
||||
{
|
||||
"token": "CONNECTING",
|
||||
|
|
Loading…
Add table
Reference in a new issue