mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-14 23:21:31 +10:00
reset configportal timeouts after ap disconnect
configportaltimeout now starts at configportalstart if no sta clients, or after last client disconnects. Will never timeout if ap has sta client! handle edge case in user code.
This commit is contained in:
+10
-5
@@ -157,6 +157,14 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
return startConfigPortal(apName, apPassword);
|
||||
}
|
||||
|
||||
boolean WiFiManager::configPortalHasTimeout(){
|
||||
if(_configPortalTimeout == 0 || wifi_softap_get_station_num() > 0){
|
||||
_configPortalStart = millis(); // kludge, bump configportal start time to skew timeouts
|
||||
return false;
|
||||
}
|
||||
return (millis() > _configPortalStart + _configPortalTimeout);
|
||||
}
|
||||
|
||||
boolean WiFiManager::startConfigPortal() {
|
||||
String ssid = "ESP" + String(ESP.getChipId());
|
||||
return startConfigPortal(ssid.c_str(), NULL);
|
||||
@@ -180,11 +188,8 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
|
||||
|
||||
while(1){
|
||||
|
||||
// do timeout if configPortalTimeout set and ap does not have client
|
||||
if(_configPortalTimeout!= 0
|
||||
&& millis() > _configPortalStart + _configPortalTimeout
|
||||
&& wifi_softap_get_station_num() == 0
|
||||
) break;
|
||||
// check if timeout
|
||||
if(configPortalHasTimeout()) break;
|
||||
|
||||
//DNS
|
||||
dnsServer->processNextRequest();
|
||||
|
||||
Reference in New Issue
Block a user