mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-14 15:11:32 +10:00
Merge remote-tracking branch 'refs/remotes/tzapu/master'
This commit is contained in:
+13
-1
@@ -159,6 +159,14 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword, boo
|
||||
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,7 +188,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
|
||||
|
||||
@@ -161,6 +161,7 @@ class WiFiManager
|
||||
void handleNotFound();
|
||||
void handle204();
|
||||
boolean captivePortal();
|
||||
boolean configPortalHasTimeout();
|
||||
|
||||
// DNS server
|
||||
const byte DNS_PORT = 53;
|
||||
|
||||
@@ -17,7 +17,7 @@ void setup() {
|
||||
//wifiManager.resetSettings();
|
||||
|
||||
//set custom ip for portal
|
||||
//wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
//wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
|
||||
//fetches ssid and pass from eeprom and tries to connect
|
||||
//if it does not connect it starts an access point with the specified name
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><br/><input id='p' name='p' length=64 type='password' placeholder='password'><br/>
|
||||
<!-- /HTTP_FORM_START -->
|
||||
<!-- HTTP_FORM_PARAM -->
|
||||
<br/><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}>
|
||||
<br/><input id='{i}' name='{n}' length='{l}' placeholder='{p}' value='{v}' {c}>
|
||||
<!-- /HTTP_FORM_PARAM -->
|
||||
<!-- HTTP_FORM_END -->
|
||||
<br/><button type='submit'>save</button></form>
|
||||
|
||||
Reference in New Issue
Block a user