showinfoerase toggle

This commit is contained in:
Shawn A
2018-03-16 14:17:58 -05:00
parent f60a1d1b06
commit d07f73263a
3 changed files with 21 additions and 10 deletions
+10 -2
View File
@@ -1217,7 +1217,7 @@ void WiFiManager::handleInfo() {
page += F("</dl>");
#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[]){
+3
View File
@@ -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
+8 -8
View File
@@ -23,14 +23,14 @@ const char HTTP_HEAD_END[] PROGMEM = "</head><body><div class='wrap'>";
const char HTTP_ROOT_MAIN[] PROGMEM = "<h1>{v}</h1><h3>WiFiManager</h3>";
const char * const HTTP_PORTAL_MENU[] PROGMEM = {
"<form action='/wifi' method='GET'><button>Configure WiFi</button></form><br/>\n", // MENU_WIFI
"<form action='/0wifi' method='GET'><button>Configure WiFi (No Scan)</button></form><br/>\n", // MENU_WIFINOSCAN
"<form action='/info' method='GET'><button>Info</button></form><br/>\n", // MENU_INFO
"<form action='/param' method='GET'><button>Setup</button></form><br/>\n",//MENU_PARAM
"<form action='/close' method='GET'><button>Close</button></form><br/>\n", // MENU_CLOSE
"<form action='/restart' method='GET'><button>Restart</button></form><br/>\n",// MENU_RESTART
"<form action='/exit' method='GET'><button>Exit</button></form>", // MENU_EXIT
"<form action='/erase' method='GET'><button>Erase</button></form>", // MENU_ERASE
"<form action='/wifi' method='get'><button>Configure WiFi</button></form><br/>\n", // MENU_WIFI
"<form action='/0wifi' method='get'><button>Configure WiFi (No Scan)</button></form><br/>\n", // MENU_WIFINOSCAN
"<form action='/info' method='get'><button>Info</button></form><br/>\n", // MENU_INFO
"<form action='/param' method='get'><button>Setup</button></form><br/>\n",//MENU_PARAM
"<form action='/close' method='get'><button>Close</button></form><br/>\n", // MENU_CLOSE
"<form action='/restart' method='get'><button>Restart</button></form><br/>\n",// MENU_RESTART
"<form action='/exit' method='get'><button>Exit</button></form><br/>\n", // MENU_EXIT
"<form action='/erase' method='get'><button class='D'>Erase</button></form><br/>\n", // MENU_ERASE
"<hr><br/>" // MENU_SEP
};