fix menuids

This commit is contained in:
Shawn A
2018-02-24 07:51:07 -06:00
parent 58d23513a1
commit 7b4fd38b6b
3 changed files with 8 additions and 7 deletions
+3 -2
View File
@@ -142,6 +142,7 @@ WiFiManager::WiFiManager():_debugPort(Serial) {
_usermode = WiFi.getMode();
WiFi.persistent(false); // disable persistent so scannetworks and mode switching do not cause overwrites
setMenu(_menuIds);
//parameters
// @todo belongs to wifimanagerparameter
_max_params = WIFI_MANAGER_MAX_PARAMS;
@@ -719,7 +720,7 @@ void WiFiManager::handleWifi(boolean scan) {
page += pitem;
page += getStaticOut();
if(_paramsInWifi){
if(_paramsInWifi && _paramsCount>0){
page += getParamOut();
page += FPSTR(HTTP_FORM_WIFI_END);
}
@@ -1757,7 +1758,7 @@ void WiFiManager::setMenu(uint8_t menu[]){
int n = sizeof(menu);
for(i=0;i<sizeof(_menuIds);i++){
if(menu[i] == MENU_PARAM) _paramsInWifi = false; // param auto flag
_menuIds[i] = i<n ? menu[i] : 255;
_menuIds[i] = i < n-1 ? menu[i] : 255;
}
}
@@ -34,7 +34,7 @@ void setup() {
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if(!wifiManager.autoConnect("AutoConnectAP","12345678")) {
if(!wifiManager.autoConnect("AutoConnectAP")) {
Serial.println("failed to connect and hit timeout");
}
+4 -4
View File
@@ -29,7 +29,7 @@ const char * const HTTP_PORTAL_MENU[] PROGMEM = {
"<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>Quit</button></form>", // MENU_EXIT
"<form action='/exit' method='GET'><button>Exit</button></form>", // MENU_EXIT
"<form action='/erase' method='GET'><button>Erase</button></form>", // MENU_ERASE
"<hr><br/>" // MENU_SEP
};
@@ -43,12 +43,12 @@ const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";
const char HTTP_FORM_WIFI[] PROGMEM = "<label for='s'>SSID</label><input id='s' name='s' maxlength=32 placeholder='{v}'><br/><label for='p'>Password</label><input id='p' name='p' maxlength='64' type='password' placeholder=''>";
const char HTTP_FORM_WIFI_END[] PROGMEM = "<hr><br>";
const char HTTP_FORM_END[] PROGMEM = "<br/><button type='submit'>Save</button></form>";
const char HTTP_FORM_WIFI_END[] PROGMEM = "<hr><br/>";
const char HTTP_FORM_END[] PROGMEM = "<br/><br/><button type='submit'>Save</button></form>";
const char HTTP_FORM_LABEL[] PROGMEM = "<label for='{i}'>{t}</label>";
const char HTTP_FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength={l} placeholder='' value='{v}' {c}>";
const char HTTP_SCAN_LINK[] PROGMEM = "<br/><form action='/wifi' method='get'><button>Refresh</button></form>";
const char HTTP_SCAN_LINK[] PROGMEM = "<br/><form action='/wifi?refresh=1' method='post'><button>Refresh</button></form>";
const char HTTP_SAVED[] PROGMEM = "<div class='msg'>Saving Credentials<br/>Trying to connect ESP to network.<br />If it fails reconnect to AP to try again</div>";
const char HTTP_PARAMSAVED[] PROGMEM = "<div class='msg'>Saved<br/></div>";
const char HTTP_END[] PROGMEM = "</div></body></html>";