Skip to content

Commit

Permalink
check connection every 5s
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Dec 6, 2023
1 parent bf6307c commit 28f4f54
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/network_interfaces/ws_networking_pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,15 @@ class ws_networking_pico : public Wippersnapper {
WiFi.setTimeout(20000);
WS.feedWDT();
WiFi.begin(_ssid, _pass);
// Here, we're going to wait 20 seconds total, matching the value within
// setTimeout().
// However, due to the global WDT of 6 sec., we need to feed the WDT
// after every 5 seconds.
// Wait setTimeout duration for a connection and check if connected every
// 5 seconds
for (int i = 0; i < 4; i++) {
delay(5000);
WS.feedWDT();
if (WiFi.status() == WL_CONNECTED) {
_status = WS_NET_CONNECTED;
return;
}
}
_status = WS_NET_DISCONNECTED;
}
Expand Down

0 comments on commit 28f4f54

Please sign in to comment.