adds option to keep cfgp open on wifi save

// if true (default) then stop the config portal from autoConnect when wifi is saved
    void          setDisableConfigPortal(boolean enable);

Name will change
This commit is contained in:
tablatronix
2022-04-08 20:44:08 -05:00
parent 590e212ddb
commit 7bffda3fe6
2 changed files with 20 additions and 5 deletions
+14 -3
View File
@@ -727,7 +727,7 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
if(!_configPortalIsBlocking){
#ifdef WM_DEBUG_LEVEL
DEBUG_WM(DEBUG_VERBOSE,F("Config Portal Running, non blocking/processing"));
DEBUG_WM(DEBUG_VERBOSE,F("Config Portal Running, non blocking (processing)"));
if(_configPortalTimeout > 0) DEBUG_WM(DEBUG_VERBOSE,F("Portal Timeout In"),(String)(_configPortalTimeout/1000) + (String)F(" seconds"));
#endif
return result; // skip blocking loop
@@ -850,7 +850,7 @@ uint8_t WiFiManager::processConfigPortal(){
_savewificallback();
}
if(!_connectonsave) return WL_IDLE_STATUS;
shutdownConfigPortal();
if(_disableConfigPortal) shutdownConfigPortal();
return WL_CONNECTED; // CONNECT SUCCESS
}
#ifdef WM_DEBUG_LEVEL
@@ -869,7 +869,7 @@ uint8_t WiFiManager::processConfigPortal(){
#endif
_savewificallback();
}
shutdownConfigPortal();
if(_disableConfigPortal) shutdownConfigPortal();
return WL_CONNECT_FAILED; // CONNECT FAIL
}
else if(_configPortalIsBlocking){
@@ -2899,6 +2899,17 @@ void WiFiManager::setEnableConfigPortal(boolean enable)
_enableConfigPortal = enable;
}
/**
* toggle configportal if autoconnect failed
* if enabled, then the configportal will be de-activated on wifi save
* @since $dev
* @access public
* @param boolean enabled [true]
*/
void WiFiManager::setDisableConfigPortal(boolean enable)
{
_disableConfigPortal = enable;
}
/**
* set the hostname (dhcp client id)