From 7cfa9798875e3298b3ee3254f51424cf673f127a Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Sun, 2 Feb 2025 13:36:01 +0100 Subject: [PATCH] second try to connect to wifi --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0889782..985d3ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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.