feat: two-tier factory reset, WiFi fallback chain, SettingsWebServer

Factory reset (F-015):
- InputManager gains MEDIUM_PRESSED state with mediumPressMs=5000
- 5s hold: wipe WiFi credentials only, restart on release
- 10s hold: full factory reset (WiFi wipe already done at 5s mark)
- New callbacks: setFactoryResetMediumPressCallback,
  setFactoryResetMediumPressReleaseCallback

WiFi fallback chain (F-016):
- Connection now cycles: saved creds → hardcoded failsafe → portal
- MAX_WIFI_FAILURES reduced 3→2 per stage
- Portal now reboots after saving credentials (fixes port 80 conflict
  between WiFiManager and AsyncWebServer)
- AP SSID sourced from netConfig.apSsid instead of hardcoded pattern
- clearWiFiCredentials() added to Networking for 5s reset gesture

SettingsWebServer (F-017):
- Instantiated in main.cpp alongside CommunicationRouter
- begin() called when network becomes ready (both WiFi paths)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 09:52:17 +03:00
co-authored by Claude Sonnet 4.6
parent ee73d4d2c4
commit df8426fce6
5 changed files with 183 additions and 124 deletions
+6 -2
View File
@@ -103,6 +103,9 @@ public:
// AP Mode control
void startPermanentAPMode();
bool isInAPMode() const { return _state == NetworkState::AP_MODE_PERMANENT; }
// Wipe WiFiManager stored credentials (SSID + password)
void clearWiFiCredentials();
// ═══════════════════════════════════════════════════════════════════════════════
// HEALTH CHECK METHOD
@@ -128,7 +131,8 @@ private:
unsigned long _lastConnectionAttempt;
bool _bootSequenceComplete;
bool _ethernetCableConnected;
int _wifiConnectionFailures; // Track consecutive WiFi failures
int _wifiConnectionFailures; // Track consecutive WiFi failures
bool _triedSavedCredentials; // True once saved-creds phase has been exhausted
// Callbacks
std::function<void()> _onNetworkConnected;
@@ -165,5 +169,5 @@ private:
// Constants
static const unsigned long RECONNECTION_INTERVAL = 5000; // 5 seconds
static const int MAX_WIFI_FAILURES = 3; // Portal after 3 failures
static const int MAX_WIFI_FAILURES = 2; // Move to next stage after 2 failures
};