diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 54fbbc5..22ed4e5 100755 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -401,18 +401,18 @@ void WiFiManager::handleRoot() { return; } - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(WM_HTTP_HEAD); page.replace("{v}", "Options"); - page += FPSTR(HTTP_SCRIPT); - page += FPSTR(HTTP_STYLE); + page += FPSTR(WM_HTTP_SCRIPT); + page += FPSTR(WM_HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(WM_HTTP_HEAD_END); page += "

"; page += _apName; page += "

"; page += F("

WiFiManager

"); - page += FPSTR(HTTP_PORTAL_OPTIONS); - page += FPSTR(HTTP_END); + page += FPSTR(WM_HTTP_PORTAL_OPTIONS); + page += FPSTR(WM_HTTP_END); server->sendHeader("Content-Length", String(page.length())); server->send(200, "text/html", page); @@ -422,12 +422,12 @@ void WiFiManager::handleRoot() { /** Wifi config page handler */ void WiFiManager::handleWifi(boolean scan) { - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(WM_HTTP_HEAD); page.replace("{v}", "Config ESP"); - page += FPSTR(HTTP_SCRIPT); - page += FPSTR(HTTP_STYLE); + page += FPSTR(WM_HTTP_SCRIPT); + page += FPSTR(WM_HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(WM_HTTP_HEAD_END); if (scan) { int n = WiFi.scanNetworks(); @@ -482,7 +482,7 @@ void WiFiManager::handleWifi(boolean scan) { int quality = getRSSIasQuality(WiFi.RSSI(indices[i])); if (_minimumQuality == -1 || _minimumQuality < quality) { - String item = FPSTR(HTTP_ITEM); + String item = FPSTR(WM_HTTP_ITEM); String rssiQ; rssiQ += quality; item.replace("{v}", WiFi.SSID(indices[i])); @@ -508,7 +508,7 @@ void WiFiManager::handleWifi(boolean scan) { } } - page += FPSTR(HTTP_FORM_START); + page += FPSTR(WM_HTTP_FORM_START); char parLength[2]; // add the extra parameters to the form for (int i = 0; i < _paramsCount; i++) { @@ -516,7 +516,7 @@ void WiFiManager::handleWifi(boolean scan) { break; } - String pitem = FPSTR(HTTP_FORM_PARAM); + String pitem = FPSTR(WM_HTTP_FORM_PARAM); if (_params[i]->getID() != NULL) { pitem.replace("{i}", _params[i]->getID()); pitem.replace("{n}", _params[i]->getID()); @@ -537,7 +537,7 @@ void WiFiManager::handleWifi(boolean scan) { if (_sta_static_ip) { - String item = FPSTR(HTTP_FORM_PARAM); + String item = FPSTR(WM_HTTP_FORM_PARAM); item.replace("{i}", "ip"); item.replace("{n}", "ip"); item.replace("{p}", "Static IP"); @@ -546,7 +546,7 @@ void WiFiManager::handleWifi(boolean scan) { page += item; - item = FPSTR(HTTP_FORM_PARAM); + item = FPSTR(WM_HTTP_FORM_PARAM); item.replace("{i}", "gw"); item.replace("{n}", "gw"); item.replace("{p}", "Static Gateway"); @@ -555,7 +555,7 @@ void WiFiManager::handleWifi(boolean scan) { page += item; - item = FPSTR(HTTP_FORM_PARAM); + item = FPSTR(WM_HTTP_FORM_PARAM); item.replace("{i}", "sn"); item.replace("{n}", "sn"); item.replace("{p}", "Subnet"); @@ -567,10 +567,10 @@ void WiFiManager::handleWifi(boolean scan) { page += "
"; } - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_SCAN_LINK); + page += FPSTR(WM_HTTP_FORM_END); + page += FPSTR(WM_HTTP_SCAN_LINK); - page += FPSTR(HTTP_END); + page += FPSTR(WM_HTTP_END); server->sendHeader("Content-Length", String(page.length())); server->send(200, "text/html", page); @@ -621,14 +621,14 @@ void WiFiManager::handleWifiSave() { optionalIPFromString(&_sta_static_sn, sn.c_str()); } - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(WM_HTTP_HEAD); page.replace("{v}", "Credentials Saved"); - page += FPSTR(HTTP_SCRIPT); - page += FPSTR(HTTP_STYLE); + page += FPSTR(WM_HTTP_SCRIPT); + page += FPSTR(WM_HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); - page += FPSTR(HTTP_SAVED); - page += FPSTR(HTTP_END); + page += FPSTR(WM_HTTP_HEAD_END); + page += FPSTR(WM_HTTP_SAVED); + page += FPSTR(WM_HTTP_END); server->sendHeader("Content-Length", String(page.length())); server->send(200, "text/html", page); @@ -642,12 +642,12 @@ void WiFiManager::handleWifiSave() { void WiFiManager::handleInfo() { DEBUG_WM(F("Info")); - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(WM_HTTP_HEAD); page.replace("{v}", "Info"); - page += FPSTR(HTTP_SCRIPT); - page += FPSTR(HTTP_STYLE); + page += FPSTR(WM_HTTP_SCRIPT); + page += FPSTR(WM_HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(WM_HTTP_HEAD_END); page += F("
"); page += F("
Chip ID
"); page += ESP_getChipId(); @@ -681,7 +681,7 @@ void WiFiManager::handleInfo() { page += WiFi.macAddress(); page += F("
"); page += F("
"); - page += FPSTR(HTTP_END); + page += FPSTR(WM_HTTP_END); server->sendHeader("Content-Length", String(page.length())); server->send(200, "text/html", page); @@ -693,14 +693,14 @@ void WiFiManager::handleInfo() { void WiFiManager::handleReset() { DEBUG_WM(F("Reset")); - String page = FPSTR(HTTP_HEAD); + String page = FPSTR(WM_HTTP_HEAD); page.replace("{v}", "Info"); - page += FPSTR(HTTP_SCRIPT); - page += FPSTR(HTTP_STYLE); + page += FPSTR(WM_HTTP_SCRIPT); + page += FPSTR(WM_HTTP_STYLE); page += _customHeadElement; - page += FPSTR(HTTP_HEAD_END); + page += FPSTR(WM_HTTP_HEAD_END); page += F("Module will reset in a few seconds."); - page += FPSTR(HTTP_END); + page += FPSTR(WM_HTTP_END); server->sendHeader("Content-Length", String(page.length())); server->send(200, "text/html", page); diff --git a/WiFiManager.h b/WiFiManager.h index 8ef5edc..7361cb7 100755 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -33,19 +33,19 @@ extern "C" { #define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) #endif -const char HTTP_HEAD[] PROGMEM = "{v}"; -const char HTTP_STYLE[] PROGMEM = ""; -const char HTTP_SCRIPT[] PROGMEM = ""; -const char HTTP_HEAD_END[] PROGMEM = "
"; -const char HTTP_PORTAL_OPTIONS[] PROGMEM = "


"; +const char WM_HTTP_HEAD[] PROGMEM = "{v}"; +const char WM_HTTP_STYLE[] PROGMEM = ""; +const char WM_HTTP_SCRIPT[] PROGMEM = ""; +const char WM_HTTP_HEAD_END[] PROGMEM = "
"; +const char WM_HTTP_PORTAL_OPTIONS[] PROGMEM = "


"; //

"; -const char HTTP_ITEM[] PROGMEM = "
{v} {r}%
"; -const char HTTP_FORM_START[] PROGMEM = "


"; -const char HTTP_FORM_PARAM[] PROGMEM = "
"; -const char HTTP_FORM_END[] PROGMEM = "
"; -const char HTTP_SCAN_LINK[] PROGMEM = "
"; -const char HTTP_SAVED[] PROGMEM = "
Credentials Saved
Trying to connect Weread to network.
If it fails reconnect to AP to try again
"; -const char HTTP_END[] PROGMEM = "
"; +const char WM_HTTP_ITEM[] PROGMEM = "
{v} {r}%
"; +const char WM_HTTP_FORM_START[] PROGMEM = "


"; +const char WM_HTTP_FORM_PARAM[] PROGMEM = "
"; +const char WM_HTTP_FORM_END[] PROGMEM = "
"; +const char WM_HTTP_SCAN_LINK[] PROGMEM = "
Scan
"; +const char WM_HTTP_SAVED[] PROGMEM = "
Credentials Saved
Trying to connect Weread to network.
If it fails reconnect to AP to try again
"; +const char WM_HTTP_END[] PROGMEM = "
"; #define WIFI_MANAGER_MAX_PARAMS 10