Skip to content

Commit 4db9a06

Browse files
Force DHCP request on WiFiMulti ::run connection
The IP address is not cleared (even if it is DHCP acquired) between ::begins on the Ethernet classes by design (#1866). But it is possible that the WiFi networks being polled by WiFiMulti are different network configurations, so force a DHCP request explicitly before (re)connecting). Fixes #2974
1 parent f3df355 commit 4db9a06

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libraries/WiFi/src/WiFiMulti.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ uint8_t WiFiMulti::run(uint32_t to) {
109109
j->bssid[0], j->bssid[1], j->bssid[2], j->bssid[3], j->bssid[4], j->bssid[5], j->rssi);
110110
}
111111

112+
// Force DHCP request
113+
WiFi.config(IPAddress(0, 0, 0, 0));
114+
112115
// Attempt to connect to each (will be in order of decreasing RSSI)
113116
for (auto j = _scanList.begin(); j != _scanList.end(); j++) {
114117
DEBUGV("[WIFIMULTI] Connecting to: SSID: '%s' -- BSSID: '%02X%02X%02X%02X%02X%02X' -- RSSI: %d\n", j->ssid,

0 commit comments

Comments
 (0)