Skip to content

Commit 28f4f54

Browse files
committed
check connection every 5s
1 parent bf6307c commit 28f4f54

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/network_interfaces/ws_networking_pico.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,15 @@ class ws_networking_pico : public Wippersnapper {
268268
WiFi.setTimeout(20000);
269269
WS.feedWDT();
270270
WiFi.begin(_ssid, _pass);
271-
// Here, we're going to wait 20 seconds total, matching the value within
272-
// setTimeout().
273-
// However, due to the global WDT of 6 sec., we need to feed the WDT
274-
// after every 5 seconds.
271+
// Wait setTimeout duration for a connection and check if connected every
272+
// 5 seconds
275273
for (int i = 0; i < 4; i++) {
276274
delay(5000);
277275
WS.feedWDT();
276+
if (WiFi.status() == WL_CONNECTED) {
277+
_status = WS_NET_CONNECTED;
278+
return;
279+
}
278280
}
279281
_status = WS_NET_DISCONNECTED;
280282
}

0 commit comments

Comments
 (0)