From d07f73263a773769d9f7fc2e2ac12998d1bdf7dc Mon Sep 17 00:00:00 2001 From: Shawn A Date: Fri, 16 Mar 2018 14:17:58 -0500 Subject: [PATCH] showinfoerase toggle --- WiFiManager.cpp | 12 ++++++++++-- WiFiManager.h | 3 +++ strings_en.h | 16 ++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index e7110a5..d63e6de 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -1217,7 +1217,7 @@ void WiFiManager::handleInfo() { page += F(""); #endif - page += FPSTR(HTTP_ERASEBTN); + if(_showInfoErase) page += FPSTR(HTTP_ERASEBTN); page += FPSTR(HTTP_HELP); page += FPSTR(HTTP_END); @@ -1875,10 +1875,18 @@ bool WiFiManager::setHostname(const char * hostname){ return true; } +/** + * toggle showing erase wifi config button on info page + * @param boolean enabled + */ +void WiFiManager::setShowInfoErase(boolean enabled){ + _showInfoErase = enabled; +} + /** * set menu items and order * if param is present, it will be removed from wifi - * @shiftIncrement $dev + * @since $dev * @param uint8_t menu[] array of menu ids */ void WiFiManager::setMenu(uint8_t menu[]){ diff --git a/WiFiManager.h b/WiFiManager.h index 2e1982b..293f7d9 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -216,6 +216,8 @@ class WiFiManager void setScanDispPerc(boolean enabled); // set a custom hostname, sets sta and ap dhcp client id for esp32, and sta for esp8266 bool setHostname(const char * hostname); + // show erase wifi onfig button on info page, true + void setShowInfoErase(boolean enabled); // set custom menu void setMenu(uint8_t menu[]); @@ -303,6 +305,7 @@ class WiFiManager boolean _webClientCheck = true; // keep cp alive if web have client boolean _scanDispOptions = false; // show percentage in scans not icons boolean _paramsInWifi = true; // show custom parameters on wifi page + boolean _showInfoErase = true; // info page erase button const char * _hostname = ""; const char* _customHeadElement = ""; // store custom head element html from user diff --git a/strings_en.h b/strings_en.h index fede69b..439c99f 100644 --- a/strings_en.h +++ b/strings_en.h @@ -23,14 +23,14 @@ const char HTTP_HEAD_END[] PROGMEM = "
"; const char HTTP_ROOT_MAIN[] PROGMEM = "

{v}

WiFiManager

"; const char * const HTTP_PORTAL_MENU[] PROGMEM = { -"

\n", // MENU_WIFI -"

\n", // MENU_WIFINOSCAN -"

\n", // MENU_INFO -"

\n",//MENU_PARAM -"

\n", // MENU_CLOSE -"

\n",// MENU_RESTART -"
", // MENU_EXIT -"
", // MENU_ERASE +"

\n", // MENU_WIFI +"

\n", // MENU_WIFINOSCAN +"

\n", // MENU_INFO +"

\n",//MENU_PARAM +"

\n", // MENU_CLOSE +"

\n",// MENU_RESTART +"

\n", // MENU_EXIT +"

\n", // MENU_ERASE "

" // MENU_SEP };