Clear reset counter after power-on delay to prevent false factory reset

This commit is contained in:
2026-06-27 01:25:31 +02:00
parent 8443260190
commit 9169bb0cb1
+7 -1
View File
@@ -725,6 +725,13 @@ void setup() {
attachMeters();
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");
WiFiManager wm;
wm.setTitle("M1730");
@@ -747,7 +754,6 @@ void setup() {
startMDNS();
mqttReconnectAt = 0;
LittleFS.remove("/reset_count");
Serial.printf("[BOOT] ready at http://%s.local or http://%s\n",
hostname, WiFi.localIP().toString().c_str());
}