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

Commit 7653f80

Browse files
authored
Merge pull request #38 from smoca-ag/master
It should be possible to start the ConfigPortal without connecting to WiFI
2 parents 73a5027 + 65083de commit 7653f80

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/ESPAsync_WiFiManager-Impl.h

Lines changed: 2 additions & 2 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,7 +633,7 @@ void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char co
633633
LOGDEBUG("SET AP STA");
634634

635635
// try to connect
636-
if (connectWifi("", "") == WL_CONNECTED)
636+
if (shouldConnectWiFi && connectWifi("", "") == WL_CONNECTED)
637637
{
638638
LOGDEBUG1(F("IP Address:"), WiFi.localIP());
639639

src/ESPAsync_WiFiManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ESPAsync_WiFiManager
319319
// If you want to start the config portal
320320
bool startConfigPortal();
321321
bool startConfigPortal(char const *apName, char const *apPassword = NULL);
322-
void startConfigPortalModeless(char const *apName, char const *apPassword);
322+
void startConfigPortalModeless(char const *apName, char const *apPassword, bool shouldConnectWiFi = true);
323323

324324

325325
// get the AP name of the config portal, so it can be used in the callback

src_cpp/ESPAsync_WiFiManager.cpp

Lines changed: 2 additions & 2 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,7 +633,7 @@ void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char co
633633
LOGDEBUG("SET AP STA");
634634

635635
// try to connect
636-
if (connectWifi("", "") == WL_CONNECTED)
636+
if (shouldConnectWiFi && connectWifi("", "") == WL_CONNECTED)
637637
{
638638
LOGDEBUG1(F("IP Address:"), WiFi.localIP());
639639

src_cpp/ESPAsync_WiFiManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ESPAsync_WiFiManager
319319
// If you want to start the config portal
320320
boolean startConfigPortal();
321321
boolean startConfigPortal(char const *apName, char const *apPassword = NULL);
322-
void startConfigPortalModeless(char const *apName, char const *apPassword);
322+
void startConfigPortalModeless(char const *apName, char const *apPassword, bool shouldConnectWiFi = true);
323323

324324

325325
// get the AP name of the config portal, so it can be used in the callback

src_h/ESPAsync_WiFiManager-Impl.h

Lines changed: 2 additions & 2 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,7 +633,7 @@ void ESPAsync_WiFiManager::startConfigPortalModeless(char const *apName, char co
633633
LOGDEBUG("SET AP STA");
634634

635635
// try to connect
636-
if (connectWifi("", "") == WL_CONNECTED)
636+
if (shouldConnectWiFi && connectWifi("", "") == WL_CONNECTED)
637637
{
638638
LOGDEBUG1(F("IP Address:"), WiFi.localIP());
639639

src_h/ESPAsync_WiFiManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ESPAsync_WiFiManager
319319
// If you want to start the config portal
320320
bool startConfigPortal();
321321
bool startConfigPortal(char const *apName, char const *apPassword = NULL);
322-
void startConfigPortalModeless(char const *apName, char const *apPassword);
322+
void startConfigPortalModeless(char const *apName, char const *apPassword, bool shouldConnectWiFi = true);
323323

324324

325325
// get the AP name of the config portal, so it can be used in the callback

0 commit comments

Comments
 (0)