Skip to content

Commit a0d176b

Browse files
committed
stop dhcp client before starting it
this is a lighter workaround for esp8266#5527 and may require better understanding of the issue
1 parent e67cc90 commit a0d176b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,18 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
204204
}
205205

206206
if(!_useStaticIp) {
207+
208+
// This is a lighter workaround for
209+
// https://github.com/esp8266/Arduino/issues/5527#issuecomment-489324157
210+
// Stopping dhcp client allows restarting it again without needing
211+
// to disconnect WiFi as a workaround
212+
// XXXTODO: properly detect a previously connected network and
213+
// behave nicely when waking up from deepsleep with
214+
// persistence enabled, wifi started and dhcp called before
215+
// actual user call to ::begin()
216+
wifi_station_dhcpc_stop();
217+
// workaround end
218+
207219
wifi_station_dhcpc_start();
208220
}
209221

0 commit comments

Comments
 (0)