Clear reset counter after power-on delay to prevent false factory reset
This commit is contained in:
+7
-1
@@ -725,6 +725,13 @@ void setup() {
|
|||||||
attachMeters();
|
attachMeters();
|
||||||
applyMeters();
|
applyMeters();
|
||||||
|
|
||||||
|
// Reset-counter settle window: if the device stays powered past this point it
|
||||||
|
// wasn't a rapid power-cycle, so clear the counter here — before the (possibly
|
||||||
|
// indefinitely blocking) WiFi portal — so a stuck/offline boot can't slowly
|
||||||
|
// accumulate into a false factory reset.
|
||||||
|
delay(3000);
|
||||||
|
LittleFS.remove("/reset_count");
|
||||||
|
|
||||||
Serial.println("[WIFI] starting WiFiManager");
|
Serial.println("[WIFI] starting WiFiManager");
|
||||||
WiFiManager wm;
|
WiFiManager wm;
|
||||||
wm.setTitle("M1730");
|
wm.setTitle("M1730");
|
||||||
@@ -747,7 +754,6 @@ void setup() {
|
|||||||
startMDNS();
|
startMDNS();
|
||||||
mqttReconnectAt = 0;
|
mqttReconnectAt = 0;
|
||||||
|
|
||||||
LittleFS.remove("/reset_count");
|
|
||||||
Serial.printf("[BOOT] ready at http://%s.local or http://%s\n",
|
Serial.printf("[BOOT] ready at http://%s.local or http://%s\n",
|
||||||
hostname, WiFi.localIP().toString().c_str());
|
hostname, WiFi.localIP().toString().c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user