Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fixes: reset wifi bug + write reboot info bug #732

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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