mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Merge remote-tracking branch 'refs/remotes/origin/feature_308_configportaltimeouts'
This commit is contained in:
+13
-1
@@ -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);
|
||||
@@ -178,7 +186,11 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
|
||||
connect = false;
|
||||
setupConfigPortal();
|
||||
|
||||
while (_configPortalTimeout == 0 || millis() < _configPortalStart + _configPortalTimeout) {
|
||||
while(1){
|
||||
|
||||
// check if timeout
|
||||
if(configPortalHasTimeout()) break;
|
||||
|
||||
//DNS
|
||||
dnsServer->processNextRequest();
|
||||
//HTTP
|
||||
|
||||
@@ -160,6 +160,7 @@ class WiFiManager
|
||||
void handleNotFound();
|
||||
void handle204();
|
||||
boolean captivePortal();
|
||||
boolean configPortalHasTimeout();
|
||||
|
||||
// DNS server
|
||||
const byte DNS_PORT = 53;
|
||||
|
||||
Reference in New Issue
Block a user