Skip to content

Commit 00065ac

Browse files
committed
Allow DHCP client to be re-enabled using WiFi.config(0U, 0U, 0U) (esp8266#1896)
1 parent 17c02ff commit 00065ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ bool ESP8266WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddres
212212
info.gw.addr = static_cast<uint32_t>(gateway);
213213
info.netmask.addr = static_cast<uint32_t>(subnet);
214214

215+
if (local_ip == 0U && gateway == 0U && subnet == 0U) {
216+
_useStaticIp = false;
217+
wifi_station_dhcpc_start();
218+
return true;
219+
}
220+
215221
wifi_station_dhcpc_stop();
216222
if(wifi_set_ip_info(STATION_IF, &info)) {
217223
_useStaticIp = true;

0 commit comments

Comments
 (0)