mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
check more states for wifi reconnect
This commit is contained in:
@@ -32,9 +32,6 @@ void NetworkSettingsService::begin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSettingsService::reconfigureWiFiConnection() {
|
void NetworkSettingsService::reconfigureWiFiConnection() {
|
||||||
// reset last connection attempt to force loop to reconnect immediately
|
|
||||||
_lastConnectionAttempt = 0;
|
|
||||||
|
|
||||||
// disconnect and de-configure wifi
|
// disconnect and de-configure wifi
|
||||||
if (WiFi.disconnect(true)) {
|
if (WiFi.disconnect(true)) {
|
||||||
_stopping = true;
|
_stopping = true;
|
||||||
@@ -91,6 +88,8 @@ void NetworkSettingsService::manageSTA() {
|
|||||||
// esp_wifi_set_max_tx_power(_state.tx_power * 4);
|
// esp_wifi_set_max_tx_power(_state.tx_power * 4);
|
||||||
WiFi.setTxPower((wifi_power_t)(_state.tx_power * 4));
|
WiFi.setTxPower((wifi_power_t)(_state.tx_power * 4));
|
||||||
#endif
|
#endif
|
||||||
|
} else { // not connected but STA-mode active => disconnect
|
||||||
|
reconfigureWiFiConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +101,8 @@ void NetworkSettingsService::WiFiEvent(WiFiEvent_t event) {
|
|||||||
_stopping = false;
|
_stopping = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// wait 3 seconds before reconnecting
|
if (!_stopping
|
||||||
// if (event == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
|
&& (event == ARDUINO_EVENT_WIFI_STA_LOST_IP || event == ARDUINO_EVENT_WIFI_STA_DISCONNECTED || event == ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE)) {
|
||||||
// _lastConnectionAttempt = millis();
|
reconfigureWiFiConnection();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user