diff --git a/src/main.cpp b/src/main.cpp index 4c7dd0d..6e23cb7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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()); }