Skip to content

Commit

Permalink
small fixes: reset wifi bug + write reboot info bug
Browse files Browse the repository at this point in the history
  • Loading branch information
visualapproach committed Jun 17, 2024
1 parent 4a458c0 commit ad9b349
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Code/lib/BWC_unified/FW_VERSION.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define FW_VERSION "2024-06-10-2016"
#define FW_VERSION "2024-06-17-1334"
4 changes: 3 additions & 1 deletion Code/lib/BWC_unified/bwc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void BWC::begin(){

void BWC::loop(){
++loop_count;
// if(loop_count % 100 == 0) Serial.printf_P(PSTR("bwc loop %d\n"), millis());
#ifdef ESP8266
ESP.wdtFeed();
#endif
Expand Down Expand Up @@ -1509,7 +1510,7 @@ void BWC::_saveCommandQueue(){
Serial.println(F("Failed to save cmdq.json"));
return;
} else {
Serial.println(F("Wrote cmdq.json"));
Serial.println(F("Writing cmdq.json"));
}
/*Do not save instant reboot command. Don't ask me how I know.*/
if(_command_que.size())
Expand All @@ -1535,6 +1536,7 @@ void BWC::_saveCommandQueue(){
// Serial.println(s);
}
file.close();
Serial.println(F("Done!"));
//revive the dog
// ESP.wdtEnable(0);
}
Expand Down
10 changes: 7 additions & 3 deletions Code/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void loop()
delay(3000);
}
//handleAUX();
// static int temp_counter = 0;
// if(++temp_counter % 100 == 0) BWC_LOG_P(PSTR("main loop %d\n"), millis());
}

/* Debugging to file, normally not used */
Expand Down Expand Up @@ -441,10 +443,12 @@ void checkNTP()
if(now < 8 * 3600 * 2)
{
if (++ntpTryNumber == 10) {
ntpTryNumber = 0; //reset until next check
ntpCheck_ticker.detach();
}
return;
}
return;
}
ntpCheck_ticker.detach(); //time is set, don't check again
struct tm timeinfo;
gmtime_r(&now, &timeinfo);
time_t boot_timestamp = getBootTime();
Expand Down Expand Up @@ -1465,8 +1469,8 @@ void resetWiFi()
updateMqttTimer.detach();
updateWSTimer.detach();
if(ntpCheck_ticker.active()) ntpCheck_ticker.detach();
bwc->stop();
bwc->saveSettings();
bwc->stop();
delay(1000);
#if defined(ESP8266)
ESP.eraseConfig();
Expand Down

0 comments on commit ad9b349

Please sign in to comment.