From 6dd8be32629a3d9cd6610da93224f3559f63c6ee Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Fri, 28 Dec 2018 21:23:17 +0200 Subject: [PATCH] Use more agressive disconnect on wifi connect error --- libraries/WiFi/src/WiFiGeneric.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 400f9d3c..c9c61e9c 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -187,7 +187,7 @@ typedef struct WiFiEventCbList { WiFiEventSysCb scb; system_event_id_t event; - WiFiEventCbList() : id(current_id++) {} + WiFiEventCbList() : id(current_id++), cb(NULL), fcb(NULL), scb(NULL), event(SYSTEM_EVENT_WIFI_READY) {} } WiFiEventCbList_t; wifi_event_id_t WiFiEventCbList::current_id = 1; @@ -371,8 +371,7 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event) (reason >= WIFI_REASON_BEACON_TIMEOUT && reason != WIFI_REASON_AUTH_FAIL)) && WiFi.getAutoReconnect()) { - WiFi.enableSTA(false); - WiFi.enableSTA(true); + WiFi.disconnect(true); WiFi.begin(); } } else if(event->event_id == SYSTEM_EVENT_STA_GOT_IP) {