no wifi disconnect until reboot on ssid cleared

This commit is contained in:
MichaelDvP
2023-10-24 21:54:57 +02:00
parent 5e7e1c30ca
commit ad51870d2c
8 changed files with 39 additions and 17 deletions

View File

@@ -28,10 +28,16 @@ void NetworkSettingsService::begin() {
WiFi.onEvent(std::bind(&NetworkSettingsService::WiFiEvent, this, _1));
_fsPersistence.readFromFS();
reconfigureWiFiConnection();
// reconfigureWiFiConnection();
_lastConnectionAttempt = 0;
_stopping = false;
}
void NetworkSettingsService::reconfigureWiFiConnection() {
// do not disconnect for switching to eth, restart is needed
if (WiFi.isConnected() && _state.ssid.length() == 0) {
return;
}
// disconnect and de-configure wifi
if (WiFi.disconnect(true)) {
_stopping = true;