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

Commit 4fe4248

Browse files
committed
set flag shouldConnectWiFi
1 parent 73a5027 commit 4fe4248

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src_cpp/ESPAsync_WiFiManager.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ void ESPAsync_WiFiManager::scan()
622622

623623
//////////////////////////////////////////
624624

625-
void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char const *apPassword)
625+
void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char const *apPassword, bool shouldConnectWiFi)
626626
{
627627
_modeless = true;
628628
_apName = apName;
@@ -633,15 +633,17 @@ void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char co
633633
LOGDEBUG("SET AP STA");
634634

635635
// try to connect
636-
if (connectWifi("", "") == WL_CONNECTED)
637-
{
638-
LOGDEBUG1(F("IP Address:"), WiFi.localIP());
639-
640-
if ( _savecallback != NULL)
641-
{
642-
//todo: check if any custom parameters actually exist, and check if they really changed maybe
643-
_savecallback();
644-
}
636+
if (shouldConnectWiFi) {
637+
if (connectWifi("", "") == WL_CONNECTED)
638+
{
639+
LOGDEBUG1(F("IP Address:"), WiFi.localIP());
640+
641+
if ( _savecallback != NULL)
642+
{
643+
//todo: check if any custom parameters actually exist, and check if they really changed maybe
644+
_savecallback();
645+
}
646+
}
645647
}
646648

647649
if ( _apcallback != NULL)

0 commit comments

Comments
 (0)