Skip to content

Commit 6dd8be3

Browse files
committed
Use more agressive disconnect on wifi connect error
1 parent 28ea39c commit 6dd8be3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: libraries/WiFi/src/WiFiGeneric.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ typedef struct WiFiEventCbList {
187187
WiFiEventSysCb scb;
188188
system_event_id_t event;
189189

190-
WiFiEventCbList() : id(current_id++) {}
190+
WiFiEventCbList() : id(current_id++), cb(NULL), fcb(NULL), scb(NULL), event(SYSTEM_EVENT_WIFI_READY) {}
191191
} WiFiEventCbList_t;
192192
wifi_event_id_t WiFiEventCbList::current_id = 1;
193193

@@ -371,8 +371,7 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
371371
(reason >= WIFI_REASON_BEACON_TIMEOUT && reason != WIFI_REASON_AUTH_FAIL)) &&
372372
WiFi.getAutoReconnect())
373373
{
374-
WiFi.enableSTA(false);
375-
WiFi.enableSTA(true);
374+
WiFi.disconnect(true);
376375
WiFi.begin();
377376
}
378377
} else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {

0 commit comments

Comments
 (0)