[WiFi] Allow for unprocessed WiFi events to timeout

Fixes nodes not being able to reconnect.
This commit is contained in:
TD-er
2021-05-17 22:55:24 +02:00
parent ceb2310f4c
commit e9b2741073
+19
View File
@@ -15,6 +15,7 @@
#define ESPEASY_WIFI_SERVICES_INITIALIZED 2
#define WIFI_RECONNECT_WAIT 20000 // in milliSeconds
#define WIFI_CONNECT_TIMEOUT 20000 // in milliSeconds
bool WiFiEventData_t::WiFiConnectAllowed() const {
if (!wifiConnectAttemptNeeded) return false;
@@ -33,6 +34,24 @@ bool WiFiEventData_t::unprocessedWifiEvents() const {
{
return false;
}
if (!processedConnect) {
if (lastConnectMoment.isSet() && lastConnectMoment.timeoutReached(WIFI_CONNECT_TIMEOUT)) {
return false;
}
}
if (!processedGotIP) {
if (lastGetIPmoment.isSet() && lastGetIPmoment.timeoutReached(WIFI_CONNECT_TIMEOUT)) {
return false;
}
}
if (!processedDisconnect) {
if (lastDisconnectMoment.isSet() && lastDisconnectMoment.timeoutReached(WIFI_CONNECT_TIMEOUT)) {
return false;
}
}
if (!processedDHCPTimeout) {
return false;
}
return true;
}