From c59ce78c5e9d3be9d00ea0a454cf8560c5ed6e7a Mon Sep 17 00:00:00 2001 From: slaesh Date: Mon, 17 Oct 2022 15:13:22 +0200 Subject: [PATCH 1/2] fix: ending portal loop without prcessing its flags --- src/ESPAsync_WiFiManager-Impl.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ESPAsync_WiFiManager-Impl.h b/src/ESPAsync_WiFiManager-Impl.h index 8772619..d9b6ba2 100644 --- a/src/ESPAsync_WiFiManager-Impl.h +++ b/src/ESPAsync_WiFiManager-Impl.h @@ -872,6 +872,9 @@ bool ESPAsync_WiFiManager::startConfigPortal(char const *apName, char const *apP } #endif // ( USING_ESP32_S2 || USING_ESP32_C3 ) + // yield before processing our flags "connect" and/or "stopConfigPortal" + yield(); + if (connect) { TimedOut = false; @@ -920,8 +923,6 @@ bool ESPAsync_WiFiManager::startConfigPortal(char const *apName, char const *apP break; } - yield(); - #if ( defined(TIME_BETWEEN_CONFIG_PORTAL_LOOP) && (TIME_BETWEEN_CONFIG_PORTAL_LOOP > 0) ) #if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3) #warning Using delay in startConfigPortal loop @@ -1832,9 +1833,6 @@ void ESPAsync_WiFiManager::handleWifiSave(AsyncWebServerRequest *request) LOGDEBUG(F("Sent wifi save page")); connect = true; //signal ready to connect/reset - - // Restore when Press Save WiFi - _configPortalTimeout = DEFAULT_PORTAL_TIMEOUT; } ////////////////////////////////////////// @@ -1888,9 +1886,6 @@ void ESPAsync_WiFiManager::handleServerClose(AsyncWebServerRequest *request) stopConfigPortal = true; //signal ready to shutdown config portal LOGDEBUG(F("Sent server close page")); - - // Restore when Press Save WiFi - _configPortalTimeout = DEFAULT_PORTAL_TIMEOUT; } ////////////////////////////////////////// From bbb144b0266caca97bf5dafbb6bfc469654961f1 Mon Sep 17 00:00:00 2001 From: slaesh Date: Mon, 17 Oct 2022 15:29:17 +0200 Subject: [PATCH 2/2] fix: set timedout to false --- src/ESPAsync_WiFiManager-Impl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ESPAsync_WiFiManager-Impl.h b/src/ESPAsync_WiFiManager-Impl.h index d9b6ba2..5a3526d 100644 --- a/src/ESPAsync_WiFiManager-Impl.h +++ b/src/ESPAsync_WiFiManager-Impl.h @@ -917,6 +917,8 @@ bool ESPAsync_WiFiManager::startConfigPortal(char const *apName, char const *apP if (stopConfigPortal) { + TimedOut = false; + LOGERROR("Stop ConfigPortal"); stopConfigPortal = false;