diff --git a/README.md b/README.md
index e237018..d9d7f58 100644
--- a/README.md
+++ b/README.md
@@ -352,6 +352,8 @@ __THANK YOU__
[bbx10](https://github.com/bbx10)
+[kentaylor](https://github.com/kentaylor)
+
[Maximiliano Duarte](https://github.com/domonetic)
[alltheblinkythings](https://github.com/alltheblinkythings)
@@ -376,7 +378,7 @@ __THANK YOU__
[walthercarsten](https://github.com/walthercarsten)
-Sorry if i have missed anyone.
+And countless others
#### Inspiration
- http://www.esp8266.com/viewtopic.php?f=29&t=2520
diff --git a/WiFiManager.cpp b/WiFiManager.cpp
index 4e4d9c6..477bc22 100644
--- a/WiFiManager.cpp
+++ b/WiFiManager.cpp
@@ -46,7 +46,7 @@ void WiFiManagerParameter::init(const char *id, const char *placeholder, const c
_value[i] = 0;
}
if (defaultValue != NULL) {
- strncpy(_value, defaultValue, length+1); // length+1 due to null terminated string
+ strncpy(_value, defaultValue, length + 1); // length+1 due to null terminated string
}
_customHTML = custom;
@@ -163,7 +163,7 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
// CONFIG PORTAL
bool WiFiManager::startAP(){
- DEBUG_WM(F("StartAP with SSID of"),_apName);
+ DEBUG_WM(F("StartAP with SSID: "),_apName);
// setup optional soft AP static ip config
if (_ap_static_ip) {
@@ -177,7 +177,7 @@ bool WiFiManager::startAP(){
if (_apPassword != "") {
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str());//password option
} else {
- DEBUG_WM(F("AP has anonymous access"));
+ DEBUG_WM(F("AP has anonymous access!"));
ret = WiFi.softAP(_apName.c_str());
}
@@ -210,7 +210,8 @@ void WiFiManager::stopWebPortal() {
}
boolean WiFiManager::configPortalHasTimeout(){
- if(_configPortalTimeout == 0 || WiFi_softap_num_stations() > 0){
+
+ if(_configPortalTimeout == 0 || (_cpClientCheck && (WiFi_softap_num_stations() > 0))){
if(millis() - timer > 30000){
timer = millis();
DEBUG_WM("NUM CLIENTS: " + (String)WiFi_softap_num_stations());
@@ -219,6 +220,8 @@ boolean WiFiManager::configPortalHasTimeout(){
return false;
}
// handle timeout
+ if(_webClientCheck && _webPortalAccessed>_configPortalStart>0) _configPortalStart = _webPortalAccessed;
+
if(millis() > _configPortalStart + _configPortalTimeout){
DEBUG_WM(F("config portal has timed out"));
return true;
@@ -261,6 +264,7 @@ void WiFiManager::setupConfigPortal() {
server->on("/r", std::bind(&WiFiManager::handleReset, this));
server->on("/exit", std::bind(&WiFiManager::handleExit, this));
server->on("/erase", std::bind(&WiFiManager::handleErase, this));
+ server->on("/status", std::bind(&WiFiManager::handleWiFiStatus, this));
//server->on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
server->onNotFound (std::bind(&WiFiManager::handleNotFound, this));
@@ -572,15 +576,21 @@ String WiFiManager::getHTTPHead(String title){
return page;
}
+/**
+ * HTTPD handler for page requests
+ */
+void WiFiManager::handleRequest() {
+ _webPortalAccessed = millis();
+}
+
/**
* HTTPD CALLBACK root or redirect to captive portal
*/
void WiFiManager::handleRoot() {
DEBUG_WM(F("<- HTTP Root"));
-
if (captivePortal()) return; // If captive portal redirect instead of displaying the page
-
- String page = getHTTPHead("options"); // @token options
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_options)); // @token options
String str = FPSTR(HTTP_ROOT_MAIN);
str.replace("{v}",configPortalActive ? _apName : WiFi.localIP().toString()); // use ip if ap is not active for heading
page += str;
@@ -597,9 +607,9 @@ void WiFiManager::handleRoot() {
* HTTPD CALLBACK Wifi config page handler
*/
void WiFiManager::handleWifi(boolean scan) {
-
DEBUG_WM("<- HTTP Wifi");
- String page = getHTTPHead("Config ESP"); // @token titlewifi
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_titlewifi)); // @token titlewifi
if (scan) {
page += getScanItemOut();
}
@@ -631,7 +641,7 @@ String WiFiManager::getScanItemOut(){
DEBUG_WM(F("Scan done"));
if (n == 0) {
DEBUG_WM(F("No networks found"));
- page += F("No networks found. Refresh to scan again."); // @token scannotfound
+ page += FPSTR(S_nonetworks); // @token nonetworks
} else {
//sort networks
@@ -718,7 +728,7 @@ String WiFiManager::getScanItemOut(){
String WiFiManager::getStaticOut(){
String page;
- if (_sta_show_static_fields || _sta_static_ip) {
+ if (_staShowStaticFields || _sta_static_ip) {
// @todo how can we get these settings from memory , wifi_get_ip_info does not seem to reveal if struct ip_info is static or not
// @todo move titles to params for i18n
@@ -728,7 +738,7 @@ String WiFiManager::getStaticOut(){
item.replace("{i}", "ip");
item.replace("{n}", "ip");
item.replace("{p}", "{t}");
- item.replace("{t}", "Static IP"); // @token staticip
+ item.replace("{t}", FPSTR(S_staticip)); // @token staticip
item.replace("{l}", "15");
item.replace("{v}", (_sta_static_ip ? _sta_static_ip.toString() : ""));
item.replace("{c}", "");
@@ -744,7 +754,7 @@ String WiFiManager::getStaticOut(){
item.replace("{i}", "gw");
item.replace("{n}", "gw");
item.replace("{p}", "{t}");
- item.replace("{t}", "Static Gateway"); // @token staticgateway
+ item.replace("{t}", FPSTR(S_staticgw)); // @token staticgw
item.replace("{l}", "15");
item.replace("{v}", (_sta_static_gw ? _sta_static_gw.toString() : ""));
item.replace("{c}", "");
@@ -760,7 +770,7 @@ String WiFiManager::getStaticOut(){
item.replace("{i}", "sn");
item.replace("{n}", "sn");
item.replace("{p}", "{t}");
- item.replace("{t}", "Subnet"); // @token subnet
+ item.replace("{t}", FPSTR(S_subnet)); // @token subnet
item.replace("{l}", "15");
item.replace("{v}", (_sta_static_sn ? _sta_static_sn.toString() : ""));
item.replace("{c}", "");
@@ -841,13 +851,23 @@ String WiFiManager::getParamOut(){
return page;
}
+void WiFiManager::handleWiFiStatus(){
+ DEBUG_WM(F("<- HTTP WiFi status "));
+ handleRequest();
+ String page;
+ // String page = "{\"result\":true,\"count\":1}";
+ page = FPSTR(HTTP_JS);
+ server->sendHeader("Content-Length", String(page.length()));
+ server->send(200, "text/html", page);
+}
+
/**
* HTTPD CALLBACK save form and redirect to WLAN config page again
*/
void WiFiManager::handleWifiSave() {
DEBUG_WM(F("<- HTTP WiFi save "));
-
DEBUG_WM(F("Method:"),server->method() == HTTP_GET ? "GET" : "POST");
+ handleRequest();
//SAVE/connect here
_ssid = server->arg("s").c_str();
@@ -890,7 +910,7 @@ void WiFiManager::handleWifiSave() {
DEBUG_WM(F("static netmask:"),sn);
}
- String page = getHTTPHead("Credentials Saved"); // @token titlewifisaved
+ String page = getHTTPHead(FPSTR(S_titlewifisaved)); // @token titlewifisaved
page += FPSTR(HTTP_SAVED);
page += FPSTR(HTTP_END);
@@ -907,127 +927,45 @@ void WiFiManager::handleWifiSave() {
*/
void WiFiManager::handleInfo() {
DEBUG_WM(F("<- HTTP Info"));
- String page = getHTTPHead("Info"); // @token titleinfo
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_titleinfo)); // @token titleinfo
reportStatus(page);
-
- // @todo add versioning here
-
- #ifdef ESP8266
- page += F("
esp8266
");
- // subject to rollover!
- page += F("- Uptime
- "); // @token uptime
- page += (String)(millis() / 1000 / 60) + " mins ";
- page += (String)((millis() / 1000) % 60) + " secs";
+ #ifdef ESP8266
+ String infoids[] = {
+ "esphead",
+ "uptime",
+ "chipid",
+ "fchipid",
+ "idesize",
+ "flashsize",
+ "sdkver",
+ "corever",
+ "bootver",
+ "cpufreq",
+ "freeheap",
+ "memsketch",
+ "memsmeter",
+ "lastreset",
+ "wifihead",
+ "apip",
+ "apmac",
+ "apssid",
+ "apbssid",
+ "staip",
+ "stagw",
+ "stasub",
+ "dnss",
+ "host",
+ "stamac",
+ "conx",
+ "autoconx"
+ };
- page += F("
- Chip ID
- "); // @token chipid
- page += WIFI_getChipId();
- page += F("
");
+ for(int i=0; i<25;i++){
+ page += getInfoData(infoids[i]);
+ }
- page += F("- Flash Chip ID
- "); // @token flashid
- page += ESP.getFlashChipId();
- page += F("
");
-
- page += F("- IDE Flash Size
- "); // @token flashsize
- page += ESP.getFlashChipSize();
- page += F(" bytes
");
-
- page += F("- Actual Flash Size
- "); // @token actualflashsize
- page += ESP.getFlashChipRealSize();
- page += F(" bytes
");
-
- page += F("- SDK Version
- "); // @token sdkver
- page += system_get_sdk_version();
- page += F("
");
-
- page += F("- Core Version
- "); // @token corever
- page += ESP.getCoreVersion();
- page += F("
");
-
- page += F("- Boot Version
- "); // @token boot ver
- page += system_get_boot_version();
- page += F("
");
-
- page += F("- CPU Frequency
- "); // @token cpufreq
- page += ESP.getCpuFreqMHz();
- page += F("MHz
");
-
- // heap is dynamic, would have to have a known starting for graph
- // uint32_t heapstart = 47000;
- // page += F("- Memory Heap
- ");
- // page += F("Used/Total bytes
");
- // page += (heapstart)-ESP.getFreeHeap();
- // page += "/";
- // page += (heapstart);
- // page += "
";
- // page += F(" ");
-
- page += F("- Memory - Free Heap
- "); // @token freeheap
- page += ESP.getFreeHeap();
- page += F(" bytes available
"); // @token bytesavail
-
- page += F("- Memory - Sketch Size
- "); // @token sketchsize
- page += F("Used/Total bytes
"); // @token usedtotal
- page += (ESP.getSketchSize()+ESP.getFreeSketchSpace())-ESP.getFreeSketchSpace();
- page += "/";
- page += (ESP.getSketchSize()+ESP.getFreeSketchSpace());
- page += F("
");
-
- page += F("- Last reset reason
- "); // @token resetreason
- page += ESP.getResetReason();
- page += F("
");
-
- page += F("
WiFi
- Access Point IP
- "); // @token apip
- page += WiFi.softAPIP().toString();
- page += F("
");
-
- page += F("- Access Point MAC
- "); // @token apmac
- page += WiFi.softAPmacAddress();
- page += F("
");
-
- page += F("- SSID
- ");
- page += WiFi_SSID();
- page += F("
");
-
- page += F("- BSSID
- ");
- page += WiFi.BSSIDstr();
- page += F("
");
-
- page += F("- Station IP
- "); // @token staip
- page += WiFi.localIP().toString();
- page += F("
");
-
- page += F("- Station Gateway
- "); // @token stagw
- page += WiFi.gatewayIP().toString();
- page += F("
");
-
- page += F("- Station Subnet
- "); // @token stasub
- page += WiFi.subnetMask().toString();
- page += F("
");
-
- page += F("- DNS Server
- "); // @token dnss
- page += WiFi.dnsIP().toString();
- page += F("
");
-
- page += F("- Hostname
- "); // @token hostname
- page += WiFi.hostname();
- page += F("
");
-
- page += F("- Station MAC
- "); // @stamac
- page += WiFi.macAddress();
- page += F("
");
-
- page += F("- Connected
- "); // @token connected
- page += WiFi.isConnected() ? "Yes" : "No"; //@token Y,N
- page += F("
");
-
- page += F("- Autoconnect
- ");
- page += WiFi.getAutoConnect() ? "Enabled" : "Disabled"; // @token enabled,disabled
- page += F("
");
page += F("
");
#endif
@@ -1127,46 +1065,141 @@ void WiFiManager::handleInfo() {
DEBUG_WM(F("Sent info page"));
}
+String WiFiManager::getInfoData(String id){
+
+ String p;
+ // @todo add versioning
+ if(id=="esphead")p = FPSTR(HTTP_INFO_esphead);
+ else if(id=="wifihead")p = FPSTR(HTTP_INFO_wifihead);
+ else if(id=="uptime"){
+ // subject to rollover!
+ p = FPSTR(HTTP_INFO_uptime);
+ p.replace("{1}",(String)(system_get_time() / 1000000 / 60));
+ p.replace("{2}",(String)((system_get_time() / 1000000)%60));
+ }
+ else if(id=="chipid"){
+ p = FPSTR(HTTP_INFO_chipid);
+ p.replace("{1}",(String)WIFI_getChipId());
+ }
+ else if(id=="fchipid"){
+ p = FPSTR(HTTP_INFO_fchipid);
+ p.replace("{1}",(String)ESP.getFlashChipId());
+ }
+ else if(id=="idesize"){
+ p = FPSTR(HTTP_INFO_idesize);
+ p.replace("{1}",(String)ESP.getFlashChipSize());
+ }
+ else if(id=="flashsize"){
+ p = FPSTR(HTTP_INFO_flashsize);
+ p.replace("{1}",(String)ESP.getFlashChipRealSize());
+ }
+ else if(id=="sdkver"){
+ p = FPSTR(HTTP_INFO_sdkver);
+ p.replace("{1}",(String)system_get_sdk_version());
+ }
+ else if(id=="corever"){
+ p = FPSTR(HTTP_INFO_corever);
+ p.replace("{1}",(String)ESP.getCoreVersion());
+ }
+ else if(id=="bootver"){
+ p = FPSTR(HTTP_INFO_bootver);
+ p.replace("{1}",(String)system_get_boot_version());
+ }
+ else if(id=="cpufreq"){
+ p = FPSTR(HTTP_INFO_cpufreq);
+ p.replace("{1}",(String)ESP.getCpuFreqMHz());
+ }
+ else if(id=="freeheap"){
+ p = FPSTR(HTTP_INFO_freeheap);
+ p.replace("{1}",(String)ESP.getFreeHeap());
+ }
+ else if(id=="memsketch"){
+ p = FPSTR(HTTP_INFO_memsketch);
+ p.replace("{1}",(String)((ESP.getSketchSize()+ESP.getFreeSketchSpace())-ESP.getFreeSketchSpace()));
+ p.replace("{2}",(String)(ESP.getSketchSize()+ESP.getFreeSketchSpace()));
+ }
+ else if(id=="memsmeter"){
+ p = FPSTR(HTTP_INFO_memsmeter);
+ p.replace("{1}",(String)((ESP.getSketchSize()+ESP.getFreeSketchSpace())-ESP.getFreeSketchSpace()));
+ p.replace("{2}",(String)(ESP.getSketchSize()+ESP.getFreeSketchSpace()));
+ }
+ else if(id=="lastreset"){
+ p = FPSTR(HTTP_INFO_lastreset);
+ p.replace("{1}",(String)ESP.getResetReason());
+ }
+ else if(id=="apip"){
+ p = FPSTR(HTTP_INFO_apip);
+ p.replace("{1}",WiFi.softAPIP().toString());
+ }
+ else if(id=="apmac"){
+ p = FPSTR(HTTP_INFO_apmac);
+ p.replace("{1}",(String)WiFi.softAPmacAddress());
+ }
+ else if(id=="apssid"){
+ p = FPSTR(HTTP_INFO_apssid);
+ p.replace("{1}",(String)WiFi.SSID());
+ }
+ else if(id=="apbssid"){
+ p = FPSTR(HTTP_INFO_apbssid);
+ p.replace("{1}",(String)WiFi.BSSIDstr());
+ }
+ else if(id=="staip"){
+ p = FPSTR(HTTP_INFO_staip);
+ p.replace("{1}",WiFi.localIP().toString());
+ }
+ else if(id=="stagw"){
+ p = FPSTR(HTTP_INFO_stagw);
+ p.replace("{1}",WiFi.gatewayIP().toString());
+ }
+ else if(id=="stasub"){
+ p = FPSTR(HTTP_INFO_stasub);
+ p.replace("{1}",WiFi.subnetMask().toString());
+ }
+ else if(id=="dnss"){
+ p = FPSTR(HTTP_INFO_dnss);
+ p.replace("{1}",WiFi.dnsIP().toString());
+ }
+ else if(id=="host"){
+ p = FPSTR(HTTP_INFO_host);
+ p.replace("{1}",WiFi.hostname());
+ }
+ else if(id=="stamac)"){
+ p = FPSTR(HTTP_INFO_stamac);
+ p.replace("{1}",WiFi.macAddress());
+ }
+ else if(id=="conx"){
+ p = FPSTR(HTTP_INFO_conx);
+ p.replace("{1}",WiFi.isConnected() ? FPSTR(S_y) : FPSTR(S_n));
+ }
+ else if(id=="autoconx"){
+ p = FPSTR(HTTP_INFO_autoconx);
+ p.replace("{1}",WiFi.getAutoConnect() ? FPSTR(S_enable) : FPSTR(S_disable));
+ }
+
+ return p;
+}
/**
* HTTPD CALLBACK root or redirect to captive portal
*/
void WiFiManager::handleExit() {
DEBUG_WM(F("<- HTTP Exit"));
- String page = getHTTPHead("Exit"); // @token titleexit
- page += "Exiting"; // @token exiting
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_titleexit)); // @token titleexit
+ page += FPSTR(S_exiting); // @token exiting
server->sendHeader("Content-Length", String(page.length()));
server->send(200, "text/html", page);
abort = true;
}
-void WiFiManager::reportStatus(String &page){
- String str;
- if (WiFi_SSID() != ""){
- if (WiFi.status()==WL_CONNECTED){
- str = FPSTR(HTTP_STATUS_ON);
- str.replace("{u}",WiFi.localIP().toString());
- str.replace("{s}",WiFi_SSID());
- }
- else {
- str = FPSTR(HTTP_STATUS_OFF);
- str.replace("{s}",WiFi_SSID());
- }
- }
- else {
- str = FPSTR(HTTP_STATUS_NONE);
- }
- page += str;
-}
-
/**
* HTTPD CALLBACK reset page
*/
void WiFiManager::handleReset() {
DEBUG_WM(F("<- HTTP Reset"));
-
- String page = getHTTPHead("Reset"); //@token titlereset
- page += F("Module will reset in a few seconds.");
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_titlereset)); //@token titlereset
+ page += FPSTR(S_resetting); //@token resetting
page += FPSTR(HTTP_END);
server->sendHeader("Content-Length", String(page.length()));
@@ -1182,14 +1215,15 @@ void WiFiManager::handleReset() {
*/
void WiFiManager::handleErase() {
DEBUG_WM(F("<- HTTP Erase"));
-
- String page = getHTTPHead("Erase"); // @token titleerase
+ handleRequest();
+ String page = getHTTPHead(FPSTR(S_titleerase)); // @token titleerase
page += FPSTR(HTTP_HEAD_END);
+
bool ret = WiFi_eraseConfig();
- if(ret) page += F("Module will reset in a few seconds."); // @token resetting
+ if(ret) page += FPSTR(S_resetting); // @token resetting
else {
- page += F("An Error Occured"); // @token erroroccur
+ page += FPSTR(S_error); // @token erroroccur
DEBUG_WM(F("[ERROR] WiFi EraseConfig failed"));
}
@@ -1204,15 +1238,18 @@ void WiFiManager::handleErase() {
}
}
+/**
+ * HTTPD CALLBACK 404
+ */
void WiFiManager::handleNotFound() {
if (captivePortal()) return; // If captive portal redirect instead of displaying the page
-
- String message = "File Not Found\n\n"; // @token notfound
- message += "URI: "; // @token uri
+ handleRequest();
+ String message = FPSTR(S_notfound); // @token notfound
+ message += FPSTR(S_uri); // @token uri
message += server->uri();
- message += "\nMethod: "; // @token method
+ message += FPSTR(S_method); // @token method
message += ( server->method() == HTTP_GET ) ? "GET" : "POST";
- message += "\nArguments: "; // @token args
+ message += FPSTR(S_args); // @token args
message += server->args();
message += "\n";
@@ -1246,6 +1283,25 @@ boolean WiFiManager::captivePortal() {
return false;
}
+void WiFiManager::reportStatus(String &page){
+ String str;
+ if (WiFi_SSID() != ""){
+ if (WiFi.status()==WL_CONNECTED){
+ str = FPSTR(HTTP_STATUS_ON);
+ str.replace("{u}",WiFi.localIP().toString());
+ str.replace("{s}",WiFi_SSID());
+ }
+ else {
+ str = FPSTR(HTTP_STATUS_OFF);
+ str.replace("{s}",WiFi_SSID());
+ }
+ }
+ else {
+ str = FPSTR(HTTP_STATUS_NONE);
+ }
+ page += str;
+}
+
// MORE SETTERS
//start up config portal callback
@@ -1280,7 +1336,7 @@ void WiFiManager::setRestorePersistent(boolean persistent) {
}
void WiFiManager::setShowStaticFields(boolean alwaysShow){
- _sta_show_static_fields = alwaysShow;
+ _staShowStaticFields = alwaysShow;
}
void WiFiManager::setCaptivePortalEnable(boolean enabled){
@@ -1291,6 +1347,14 @@ void WiFiManager::setWiFiAutoReconnect(boolean enabled){
_wifiAutoReconnect = enabled;
}
+void WiFiManager::setCaptivePortalClientCheck(boolean enabled){
+ _cpClientCheck = enabled;
+}
+
+void WiFiManager::setWebPortalClientCheck(boolean enabled){
+ _webClientCheck = enabled;
+}
+
// HELPERS
template
diff --git a/WiFiManager.h b/WiFiManager.h
index f916fbf..2f71e7f 100644
--- a/WiFiManager.h
+++ b/WiFiManager.h
@@ -150,8 +150,13 @@ class WiFiManager
void setShowStaticFields(boolean alwaysShow);
//if true disable captive portal redirection
void setCaptivePortalEnable(boolean enabled);
+ //if true, timeout captive portal even if a STA client connected (true), suggest disabling if captiveportal is open
+ void setCaptivePortalClientCheck(boolean enabled);
+ //if true, reset timeout when webclient connects (true), suggest disabling if captiveportal is open
+ void setWebPortalClientCheck(boolean enabled);
// if true enable autoreconnecting
void setWiFiAutoReconnect(boolean enabled);
+
void debugPlatformInfo();
void debugSoftAPConfig();
@@ -185,6 +190,7 @@ class WiFiManager
unsigned long _configPortalTimeout = 0;
unsigned long _connectTimeout = 0;
unsigned long _configPortalStart = 0;
+ unsigned long _webPortalAccessed = 0;
WiFiMode_t _usermode = WIFI_OFF;
#ifdef ESP8266
@@ -201,10 +207,12 @@ class WiFiManager
boolean _shouldBreakAfterConfig = false;
boolean _tryWPS = false;
boolean _configPortalIsBlocking = true;
- boolean _sta_show_static_fields = false;
+ boolean _staShowStaticFields = false;
boolean _enableCaptivePortal = true;
boolean _userpersistent = true;
boolean _wifiAutoReconnect = false;
+ boolean _cpClientCheck = false; // keep cp alive if cp have station
+ boolean _webClientCheck = true; // keep cp alive if web have client
const char* _customHeadElement = "";
@@ -226,6 +234,8 @@ class WiFiManager
void handleNotFound();
void handleExit();
void handleErase();
+ void handleWiFiStatus();
+ void handleRequest();
boolean captivePortal();
boolean configPortalHasTimeout();
@@ -261,6 +271,7 @@ class WiFiManager
boolean validApPassword();
String encryptionTypeStr(uint8_t authmode);
void reportStatus(String &page);
+ String getInfoData(String id);
// flags
boolean connect;
diff --git a/examples/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
index bc6130c..0b80f51 100644
--- a/examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
+++ b/examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
@@ -51,7 +51,7 @@ void loop() {
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
- //wifiManager.setConfigPortalTimeout(120);
+ wifiManager.setConfigPortalTimeout(120);
//it starts an access point with the specified name
//here "AutoConnectAP"
@@ -66,16 +66,11 @@ void loop() {
if (!wifiManager.startConfigPortal("OnDemandAP")) {
Serial.println("failed to connect and hit timeout");
delay(3000);
- //reset and try again, or maybe put it to deep sleep
- ESP.restart();
- delay(5000);
- }
-
- //if you get here you have connected to the WiFi
- Serial.println("connected...yeey :)");
+ } else {
+ //if you get here you have connected to the WiFi
+ Serial.println("connected...yeey :)");
+ }
}
-
// put your main code here, to run repeatedly:
-
}
diff --git a/strings_en.h b/strings_en.h
index 15c9a1e..dcc13c9 100644
--- a/strings_en.h
+++ b/strings_en.h
@@ -68,4 +68,83 @@ const char HTTP_HELP[] PROGMEM =
""
"More information about WiFiManager at https://github.com/tzapu/WiFiManager.";
-#endif
\ No newline at end of file
+const char HTTP_JS[] PROGMEM =
+"";
+
+const char HTTP_INFO_esphead[] PROGMEM = "esp8266
";
+const char HTTP_INFO_wifihead[] PROGMEM = "
WiFi
";
+
+const char HTTP_INFO_uptime[] PROGMEM = "- Uptime
{1} Mins {2} Secs";
+const char HTTP_INFO_chipid[] PROGMEM = "- Chip ID
{1}";
+const char HTTP_INFO_fchipid[] PROGMEM = "- Flash Chip ID
- {1}
";
+const char HTTP_INFO_idesize[] PROGMEM = "- IDE Flash Size
- {1} bytes
";
+const char HTTP_INFO_flashsize[] PROGMEM = "- Actual Flash Size
- {1} bytes
";
+const char HTTP_INFO_sdkver[] PROGMEM = "- SDK Version
- {1}
";
+const char HTTP_INFO_corever[] PROGMEM = "- Core Version
- {1}
";
+const char HTTP_INFO_bootver[] PROGMEM = "- Boot Version
- {1}
";
+const char HTTP_INFO_cpufreq[] PROGMEM = "- CPU Frequency
- {1}MHz
";
+const char HTTP_INFO_freeheap[] PROGMEM = "- Memory - Free Heap
- {1} bytes available
";
+const char HTTP_INFO_memsketch[] PROGMEM = "- Memory - Sketch Size
- {1}";
+const char HTTP_INFO_memstbytes[] PROGMEM = "Used/Total bytes
{1}/{2}";
+const char HTTP_INFO_memsmeter[] PROGMEM = "
";
+const char HTTP_INFO_lastreset[] PROGMEM = "- Last reset reason
- {1}
";
+const char HTTP_INFO_apip[] PROGMEM = "- Access Point IP
- {1}
";
+const char HTTP_INFO_apmac[] PROGMEM = "- Access Point MAC
- {1}
";
+const char HTTP_INFO_apssid[] PROGMEM = "- SSID
- {1}
";
+const char HTTP_INFO_apbssid[] PROGMEM = "- BSSID
- {1}
";
+const char HTTP_INFO_staip[] PROGMEM = "- Station IP
- {1}
";
+const char HTTP_INFO_stagw[] PROGMEM = "- Station Gateway
- {1}
";
+const char HTTP_INFO_stasub[] PROGMEM = "- Station Subnet
- {1}
";
+const char HTTP_INFO_dnss[] PROGMEM = "- DNS Server
- {1}
";
+const char HTTP_INFO_host[] PROGMEM = "- Hostname
- {1}
";
+const char HTTP_INFO_stamac[] PROGMEM = "- Station MAC
- {1}
";
+const char HTTP_INFO_conx[] PROGMEM = "- Connected
- {1}
";
+const char HTTP_INFO_autoconx[] PROGMEM = "- Autoconnect
- {1}
";
+
+const char S_y[] PROGMEM = "Yes";
+const char S_n[] PROGMEM = "No";
+const char S_enable[] PROGMEM = "Enabled";
+const char S_disable[] PROGMEM = "Disabled";
+
+const char S_titlewifisaved[] PROGMEM = "Credentials Saved"; // @token titlewifisaved
+const char S_titlewifi[] PROGMEM = "Config ESP"; // @token titlewifi
+const char S_titleinfo[] PROGMEM = "Info"; // @token titleinfo
+const char S_titleexit[] PROGMEM = "Exit"; // @token titleexit
+const char S_titlereset[] PROGMEM = "Reset"; //@token titlereset
+const char S_titleerase[] PROGMEM = "Erase"; // @token titleerase
+const char S_options[] PROGMEM = "options"; // @token options
+const char S_nonetworks[] PROGMEM = "No networks found. Refresh to scan again."; // @token nonetworks
+const char S_staticip[] PROGMEM = "Static IP"; // @token staticip
+const char S_staticgw[] PROGMEM = "Static Gateway"; // @token staticgw
+const char S_subnet[] PROGMEM = "Subnet"; // @token subnet
+const char S_exiting[] PROGMEM = "Exiting"; // @token exiting
+const char S_resetting[] PROGMEM = "Module will reset in a few seconds."; //@token resetting
+const char S_error[] PROGMEM = "An Error Occured"; // @token erroroccur
+const char S_notfound[] PROGMEM = "File Not Found\n\n"; // @token notfound
+const char S_uri[] PROGMEM = "URI: "; // @token uri
+const char S_method[] PROGMEM = "\nMethod: "; // @token method
+const char S_args[] PROGMEM = "\nArguments: "; // @token args
+
+#endif
+