fix: keep external station profiles authoritative

This commit is contained in:
2026-09-05 23:40:35 +10:00
parent d2265e4a0d
commit e2dcf9a1f3
5 changed files with 16 additions and 4 deletions
+7
View File
@@ -349,6 +349,13 @@ bool WiFiManager::startStationConnection(char const *apName, char const *apPassw
_stationStatus.configuredProfiles = configuredStationProfileCount(_stationProfiles);
if (!validateStationProfiles(_stationProfiles)) {
// In station-profile mode the caller store is the single source of
// truth. ESP32 can reconnect from credentials retained in its own NVS
// before the portal is started, which would otherwise bypass an empty or
// invalid external profile set. Clear only that SDK-owned state here;
// the external store remains untouched and is what the portal will save.
WiFi_Disconnect();
WiFi_eraseConfig();
_stationStatus.message = _stationStatus.configuredProfiles == 0
? F("No WiFi profiles configured")
: F("Stored WiFi profiles are invalid");