Skip to content

Commit 6e0d6a2

Browse files
Avoid rescanning/connecting on WiFiMulti.run (#782)
If the WiFi network is already up, don't run the scan and connection algorithm in WiFiMulti.
1 parent a2465f5 commit 6e0d6a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/WiFi/src/WiFiMulti.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ bool WiFiMulti::addAP(const char *ssid, const char *pass) {
5858
}
5959

6060
uint8_t WiFiMulti::run(uint32_t to) {
61+
62+
// If we're already connected, don't re-scan/etc.
63+
if (WiFi.status() == WL_CONNECTED) {
64+
return WL_CONNECTED;
65+
}
66+
6167
int cnt = WiFi.scanNetworks();
6268
if (!cnt) {
6369
return WL_DISCONNECTED;

0 commit comments

Comments
 (0)