";
- page += "
Not Connected to ";
- page += WiFi.SSID();
- }
- } else {
- page += "
";
- page += "No AP set";
+ 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());
+ }
}
- page += "
";
+ else {
+ str = FPSTR(HTTP_STATUS_NONE);
+ }
+ page += str;
}
/**
@@ -1098,12 +1063,7 @@ void WiFiManager::reportStatus(String &page){
void WiFiManager::handleReset() {
DEBUG_WM(F("<- HTTP Reset"));
- String page = FPSTR(HTTP_HEAD);
- page.replace("{v}", "Reset");
- page += FPSTR(HTTP_SCRIPT);
- page += FPSTR(HTTP_STYLE);
- page += _customHeadElement;
- page += FPSTR(HTTP_HEAD_END);
+ String page = getHTTPHead("Reset");
page += F("Module will reset in a few seconds.");
page += FPSTR(HTTP_END);
@@ -1121,15 +1081,10 @@ void WiFiManager::handleReset() {
void WiFiManager::handleErase() {
DEBUG_WM(F("<- HTTP Erase"));
- String page = FPSTR(HTTP_HEAD);
- page.replace("{v}", "Erase");
- page += FPSTR(HTTP_SCRIPT);
- page += FPSTR(HTTP_STYLE);
- page += _customHeadElement;
+ String page = getHTTPHead("Erase");
page += FPSTR(HTTP_HEAD_END);
-
bool ret = WiFi_eraseConfig();
-
+
if(ret) page += F("Module will reset in a few seconds.");
else {
page += F("An Error Occured");
diff --git a/WiFiManager.h b/WiFiManager.h
index 4c0065a..d0b90be 100644
--- a/WiFiManager.h
+++ b/WiFiManager.h
@@ -205,6 +205,7 @@ class WiFiManager
String getParamOut();
String getScanItemOut();
String getStaticOut();
+ String getHTTPHead(String title);
//helpers
String getWLStatusString(uint8_t status);
diff --git a/strings_en.h b/strings_en.h
index abda51c..bf5f112 100644
--- a/strings_en.h
+++ b/strings_en.h
@@ -1,6 +1,7 @@
const char HTTP_HEAD[] PROGMEM = "
{v}";
const char HTTP_SCRIPT[] PROGMEM = "";
const char HTTP_HEAD_END[] PROGMEM = "
";
+const char HTTP_ROOT_MAIN[] PROGMEM = "
{v}
WiFiManager
";
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "
";
const char HTTP_ITEM[] PROGMEM = "
";
// const char HTTP_ITEM[] PROGMEM = "
"; // test all tokens
@@ -13,6 +14,11 @@ const char HTTP_FORM_PARAM_END[] PROGMEM = "
";
const char HTTP_SCAN_LINK[] PROGMEM = "
";
const char HTTP_SAVED[] PROGMEM = "
Saving Credentials
Trying to connect ESP to network.
If it fails reconnect to AP to try again
";
const char HTTP_END[] PROGMEM = "
";
+const char HTTP_ERASEBTN[] PROGMEM = "
";
+
+const char HTTP_STATUS_ON[] PROGMEM = "
Connected to {s}
with IP {u}
";
+const char HTTP_STATUS_OFF[] PROGMEM = "
Not Connected to {s}
";
+const char HTTP_STATUS_NONE[] PROGMEM = "
No AP set
";
const char HTTP_STYLE[] PROGMEM = "