Skip to content

Commit a22a098

Browse files
mcsprhasenradball
authored andcommitted
Without autoreconnect, forcibly stop station connection manager (esp8266#8607)
1 parent c5b3db5 commit a22a098

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA
277277
/**
278278
* Disconnect from the network (close AP)
279279
* @param wifioff disable mode?
280-
* @return one value of wl_status_t enum
280+
* @return operation success
281281
*/
282282
bool ESP8266WiFiAPClass::softAPdisconnect(bool wifioff) {
283283
bool ret;

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,14 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg)
222222
System_Event_t* event = reinterpret_cast<System_Event_t*>(arg);
223223
DEBUG_WIFI("wifi evt: %d\n", event->event);
224224

225-
if(event->event == EVENT_STAMODE_DISCONNECTED) {
225+
if (event->event == EVENT_STAMODE_DISCONNECTED) {
226226
DEBUG_WIFI("STA disconnect: %d\n", event->event_info.disconnected.reason);
227+
// workaround for https://github.com/esp8266/Arduino/issues/7432
228+
// still delivers the event, just handle this specific case
229+
if ((wifi_station_get_connect_status() == STATION_GOT_IP) && !wifi_station_get_reconnect_policy()) {
230+
DEBUG_WIFI("forcibly stopping the station connection manager\n");
231+
wifi_station_disconnect();
232+
}
227233
}
228234

229235
if (event->event == EVENT_STAMODE_AUTHMODE_CHANGE) {

0 commit comments

Comments
 (0)