feat: triple power-cycle factory reset (no FTDI needed)
Power-cycle the device 3 times within 10 seconds to trigger factory reset: - Clears WiFi credentials (SSID + password) in EEPROM - Shows "FACTORY RESET / WiFi: TJ56654-Setup / Pass: 12345678" on display - Reboots into WiFiManager AP mode for reconfiguration Counter stored at EEPROM offset 480 (well past Config ~260 bytes). Clears automatically after 10s of stable operation. Prevents the need for FTDI/USB recovery when credentials are corrupted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
e9dc158a4e
commit
5b8a58715e
@@ -167,4 +167,16 @@ const unsigned long NTP_TIMEOUT_MS = 5000; // 5 second timeout
|
||||
// WiFi timeout
|
||||
const unsigned long WIFI_TIMEOUT_MS = 10000; // 10 second timeout
|
||||
|
||||
// Triple power-cycle factory reset
|
||||
// Counter stored at EEPROM offset 480, well past Config (~260 bytes)
|
||||
#define RESET_COUNTER_ADDR 480
|
||||
#define RESET_COUNTER_MAGIC 0xA5
|
||||
#define RESET_COUNTER_WINDOW 10000UL // 10s: if device runs longer, counter clears
|
||||
#define RESET_COUNTER_TRIPS 3 // 3 quick power cycles = factory reset
|
||||
|
||||
struct ResetCounter {
|
||||
uint8_t magic;
|
||||
uint8_t count;
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user