Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 05d72f9

Browse files
committedJul 16, 2018
fix WiFi STA going into loop in some cases of disconnect
1 parent b14f82b commit 05d72f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,17 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
365365
} else if(reason == WIFI_REASON_BEACON_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
366366
WiFiSTAClass::_setStatus(WL_CONNECTION_LOST);
367367
} else if(reason == WIFI_REASON_AUTH_EXPIRE) {
368-
if(WiFi.getAutoReconnect()){
369-
WiFi.begin();
370-
}
368+
371369
} else {
372370
WiFiSTAClass::_setStatus(WL_DISCONNECTED);
373371
}
374372
clearStatusBits(STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT);
375-
if(reason >= WIFI_REASON_BEACON_TIMEOUT && reason != WIFI_REASON_AUTH_FAIL && WiFi.getAutoReconnect()){
373+
if(((reason == WIFI_REASON_AUTH_EXPIRE) ||
374+
(reason >= WIFI_REASON_BEACON_TIMEOUT && reason != WIFI_REASON_AUTH_FAIL)) &&
375+
WiFi.getAutoReconnect())
376+
{
377+
WiFi.enableSTA(false);
378+
WiFi.enableSTA(true);
376379
WiFi.begin();
377380
}
378381
} else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {

1 commit comments

Comments
 (1)

Viper2000XXL commented on Jul 31, 2018

@Viper2000XXL

This commit is causing Event SYSTEM_EVENT_STA_DISCONNECTED not to be fired! Even the WiFi-Event example in Arduino IDE is not working in case of Disconnect. Lines 377 and 378 are the Problem - if you comment these lines out it is working again.

Please sign in to comment.