Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 05d72f9

Browse filesBrowse files
committed
fix WiFi STA going into loop in some cases of disconnect
1 parent b14f82b commit 05d72f9
Copy full SHA for 05d72f9

File tree

1 file changed

+7
-4
lines changed
Filter options

1 file changed

+7
-4
lines changed

‎libraries/WiFi/src/WiFiGeneric.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiGeneric.cpp
+7-4Lines 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) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.