Skip to content

Commit

Permalink
second try to connect to wifi
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Feb 2, 2025
1 parent e52f27f commit 7cfa979
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,8 +1647,16 @@ void StartWiFi() {
WiFi.begin(ssid.substring(0, ssid_length).c_str(),
pwd.substring(0, pwd_length).c_str());

if (WiFi.waitForConnectResult(120000UL) != WL_CONNECTED) {
softAPFallback = true;
uint8_t error = WiFi.waitForConnectResult();
if (error != WL_CONNECTED) {
display->DisplayText("No WiFi connection, error ", 10,
TOTAL_HEIGHT / 2 - 9, 255, 0, 0);
DisplayNumber(error, 3, 26, TOTAL_HEIGHT / 2 - 9, 255, 0, 0);
// second try
error = WiFi.waitForConnectResult();
if (error != WL_CONNECTED) {
softAPFallback = true;
}
}
} else {
// Don't use the fallback to skip the countdown.
Expand Down

0 comments on commit 7cfa979

Please sign in to comment.