Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 82f12e1

Browse files
authored
Merge pull request #119 from slaesh/fix-stopping-loop-without-taking-action2
fix: ending portal loop without processing its flags
2 parents c26622f + bbb144b commit 82f12e1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/ESPAsync_WiFiManager-Impl.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,9 @@ bool ESPAsync_WiFiManager::startConfigPortal(char const *apName, char const *apP
863863
}
864864
#endif // ( USING_ESP32_S2 || USING_ESP32_C3 )
865865

866+
// yield before processing our flags "connect" and/or "stopConfigPortal"
867+
yield();
868+
866869
if (connect)
867870
{
868871
TimedOut = false;
@@ -905,14 +908,14 @@ bool ESPAsync_WiFiManager::startConfigPortal(char const *apName, char const *apP
905908

906909
if (stopConfigPortal)
907910
{
911+
TimedOut = false;
912+
908913
LOGERROR("Stop ConfigPortal");
909914

910915
stopConfigPortal = false;
911916
break;
912917
}
913918

914-
yield();
915-
916919
#if ( defined(TIME_BETWEEN_CONFIG_PORTAL_LOOP) && (TIME_BETWEEN_CONFIG_PORTAL_LOOP > 0) )
917920
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
918921
#warning Using delay in startConfigPortal loop
@@ -1823,9 +1826,6 @@ void ESPAsync_WiFiManager::handleWifiSave(AsyncWebServerRequest *request)
18231826
LOGDEBUG(F("Sent wifi save page"));
18241827

18251828
connect = true; //signal ready to connect/reset
1826-
1827-
// Restore when Press Save WiFi
1828-
_configPortalTimeout = DEFAULT_PORTAL_TIMEOUT;
18291829
}
18301830

18311831
//////////////////////////////////////////
@@ -1879,9 +1879,6 @@ void ESPAsync_WiFiManager::handleServerClose(AsyncWebServerRequest *request)
18791879
stopConfigPortal = true; //signal ready to shutdown config portal
18801880

18811881
LOGDEBUG(F("Sent server close page"));
1882-
1883-
// Restore when Press Save WiFi
1884-
_configPortalTimeout = DEFAULT_PORTAL_TIMEOUT;
18851882
}
18861883

18871884
//////////////////////////////////////////

0 commit comments

Comments
 (0)