Răsfoiți Sursa

Merge pull request #7 from judge2005/master

Fix re-connecting issue
Alan Steremberg 7 ani în urmă
părinte
comite
6c5e10fd74
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      ESPAsyncWiFiManager.cpp

+ 6 - 1
ESPAsyncWiFiManager.cpp

@@ -430,7 +430,12 @@ int AsyncWiFiManager::connectWifi(String ssid, String pass) {
 //  }
 //  }
   //check if we have ssid and pass and force those, if not, try with last saved values
   //check if we have ssid and pass and force those, if not, try with last saved values
   if (ssid != "") {
   if (ssid != "") {
-    WiFi.begin(ssid.c_str(), pass.c_str());
+      //trying to fix connection in progress hanging
+      ETS_UART_INTR_DISABLE();
+      wifi_station_disconnect();
+      ETS_UART_INTR_ENABLE();
+
+      WiFi.begin(ssid.c_str(), pass.c_str());
   } else {
   } else {
     if (WiFi.SSID()) {
     if (WiFi.SSID()) {
       DEBUG_WM("Using last saved values, should be faster");
       DEBUG_WM("Using last saved values, should be faster");