Skip to content

Commit dae0c5b

Browse files
committed
ESP8266: WiFiMulti does RSSI sorting, normal wifi begin would require channel + bssid
1 parent f5ab75d commit dae0c5b

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

src/network_interfaces/Wippersnapper_ESP8266.h

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -329,38 +329,28 @@ class Wippersnapper_ESP8266 : public Wippersnapper {
329329
WS._multiNetworks[i].pass);
330330
}
331331
}
332-
// add default network
333-
if (_wifiMulti.existsAP(_ssid) == false) {
334-
_wifiMulti.addAP(_ssid, _pass);
335-
}
336-
long startRetry = millis();
337-
WS_DEBUG_PRINTLN("CONNECTING");
338-
while (_wifiMulti.run(5000) != WL_CONNECTED &&
339-
millis() - startRetry < 10000) {
340-
// ESP8266 WDT requires yield() during a busy-loop so it doesn't bite
341-
yield();
342-
}
343-
if (WiFi.status() == WL_CONNECTED) {
344-
_status = WS_NET_CONNECTED;
345-
} else {
346-
_status = WS_NET_DISCONNECTED;
347-
}
332+
}
333+
334+
// add default network
335+
if (_wifiMulti.existsAP(_ssid) == false) {
336+
_wifiMulti.addAP(_ssid, _pass);
337+
}
338+
339+
long startRetry = millis();
340+
WS_DEBUG_PRINTLN("CONNECTING");
341+
342+
while (_wifiMulti.run(5000) != WL_CONNECTED &&
343+
millis() - startRetry < 10000) {
344+
// ESP8266 WDT requires yield() during a busy-loop so it doesn't bite
345+
yield();
346+
}
347+
348+
if (WiFi.status() == WL_CONNECTED) {
349+
_status = WS_NET_CONNECTED;
348350
} else {
349-
// single network mode
350-
351-
// wait for a connection to be established
352-
long startRetry = millis();
353-
WS_DEBUG_PRINTLN("CONNECTING");
354-
while (WiFi.status() != WL_CONNECTED && millis() - startRetry < 10000) {
355-
// ESP8266 WDT requires yield() during a busy-loop so it doesn't bite
356-
yield();
357-
}
358-
if (WiFi.status() == WL_CONNECTED) {
359-
_status = WS_NET_CONNECTED;
360-
} else {
361-
_status = WS_NET_DISCONNECTED;
362-
}
351+
_status = WS_NET_DISCONNECTED;
363352
}
353+
364354
WS.feedWDT();
365355
}
366356
}

0 commit comments

Comments
 (0)