fix up menus

This commit is contained in:
Shawn A
2018-02-23 10:02:09 -06:00
parent dfd48c2c81
commit 6ba4a2523c
4 changed files with 22 additions and 5 deletions
+3 -1
View File
@@ -189,6 +189,8 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
// so we must force it on else, if not connectimeout then waitforconnectionresult gets stuck endless loop
WiFi_autoReconnect();
getMenuOut();
// set hostname before stating
if((String)_hostname != ""){
bool res = true;
@@ -737,7 +739,7 @@ String WiFiManager::getMenuOut(){
int i;
for(i=0;i<sizeof(_menuIds);i++){
if(_menuIds[i] == 255) continue;
if((i == MENU_PARAM) && (_paramsCount == 0)) continue; // no params set, omit params
if((_menuIds[i] == MENU_PARAM) && (_paramsCount == 0)) continue; // no params set, omit params
page += HTTP_PORTAL_MENU[_menuIds[i]];
}
return page;
+1 -1
View File
@@ -210,7 +210,7 @@ class WiFiManager
std::unique_ptr<WM_WebServer> server;
// std:vector<uint8_t> _menuids;
uint8_t _menuIds[7] = {MENU_WIFI,MENU_INFO,MENU_PARAM,MENU_SEP,MENU_CLOSE,MENU_ERASE,MENU_EXIT};
uint8_t _menuIds[3] = {MENU_WIFI,MENU_INFO,MENU_EXIT};
// ip configs
IPAddress _ap_static_ip;
+15 -1
View File
@@ -137,6 +137,10 @@ dd {
td {
vertical-align: top;
}
button.D{
background-color:#d9534f;
}
</style>
<!-- /HTTP_STYLE -->
<!-- HTTP_SCRIPT -->
@@ -154,8 +158,18 @@ td {
<h2>/</h2><hR>
<!-- /SAMPLE -->
<!-- HTTP_PORTAL_OPTIONS -->
<form action='/wifi' method='get'><button>Configure WiFi</button></form><br/><form action='/0wifi' method='get'><button>Configure WiFi (No Scan)</button></form><br/><form action='/i' method='get'><button>Info</button></form><br/><form action='/r' method='post'><button>Restart</button></form>
<!-- /HTTP_PORTAL_OPTIONS -->
<!-- HTTP_PORTAL_MENU[] -->
<form action='/wifi' method='get'><button>Configure WiFi</button></form><br/>
<form action='/0wifi' method='get'><button>Configure WiFi (No Scan)</button></form><br/>
<form action='/info' method='get'><button>Info</button></form><br/>
<form action='/param' method='get'><button>Setup</button></form><br/>
<Hr><br/>
<form action='/close' method='post'><button>Close</button></form><br/>
<form action='/erase' method='post'><button class='D'>Erase</button></form><br/>
<form action='/restart' method='post'><button>Restart</button></form><br/>
<form action='/exit' method='post'><button>Exit</button></form><br/>
<!-- /HTTP_PORTAL_MENU -->
<!-- SAMPLE -->
<h2>/wifi</h2><hr>
<div><a href='#p' onclick='c(this)'>Acccess Point 01</a><div role='img' aria-label='88%' title='88%' class='q q-4 l'></div></div>
+3 -2
View File
@@ -31,7 +31,7 @@ const char * const HTTP_PORTAL_MENU[] PROGMEM = {
"<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='/erase' method='GET'><button>Erase</button></form>", // MENU_ERASE
"<hr>" // MENU_SEP
"<hr><br/>" // MENU_SEP
};
// const char HTTP_PORTAL_OPTIONS[] PROGMEM = strcat(HTTP_PORTAL_MENU[0] , HTTP_PORTAL_MENU[3] , HTTP_PORTAL_MENU[7]);
@@ -52,7 +52,7 @@ const char HTTP_FORM_PARAM_END[] PROGMEM = "<br/>";
const char HTTP_SCAN_LINK[] PROGMEM = "<br/><form action='/wifi' method='get'><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_END[] PROGMEM = "</div></body></html>";
const char HTTP_ERASEBTN[] PROGMEM = "<br/><form action='/erase' method='get'><button>Erase WiFi Config</button></form>";
const char HTTP_ERASEBTN[] PROGMEM = "<br/><form action='/erase' method='get'><button class='D'>Erase WiFi Config</button></form>";
const char HTTP_STATUS_ON[] PROGMEM = "<div class='msg P'><strong>Connected</strong> to {v}<br/><em><small>with IP {i}</small></em></div>";
const char HTTP_STATUS_OFF[] PROGMEM = "<div class='msg {c}'><strong>Not Connected</strong> to {v}{r}</div>";
@@ -80,6 +80,7 @@ const char HTTP_STYLE[] PROGMEM = "<style>"
"dt{font-weight:bold}dd{margin:0;padding:0 0 0.5em 0;min-height:12px}"
"td{vertical-align: top;}"
".h{display:none}"
"button.D{background-color:#d9534f}"
"</style>";
const char HTTP_HELP[] PROGMEM =