mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
presentation tweaks
This commit is contained in:
+11
-8
@@ -293,14 +293,16 @@ void WiFiManager::handleRoot() {
|
||||
server->sendContent_P(HTTP_SCRIPT);
|
||||
server->sendContent_P(HTTP_STYLE);
|
||||
server->sendContent_P(HTTP_HEAD_END);
|
||||
|
||||
//server->sendContent(F("<h1>"));
|
||||
String title = "<h1>";
|
||||
title += _apName;
|
||||
title += "</h1>";
|
||||
server->sendContent(title);
|
||||
server->sendContent(F("<h3>WiFiManager</h3>"));
|
||||
|
||||
|
||||
server->sendContent(
|
||||
"<form action=\"/wifi\" method=\"get\"><button>Configure WiFi</button></form><br/>"
|
||||
);
|
||||
server->sendContent(
|
||||
"<form action=\"/0wifi\" method=\"get\"><button>Configure WiFi (No Scan)</button></form>"
|
||||
);
|
||||
|
||||
server->sendContent_P(HTTP_PORTAL_OPTIONS);
|
||||
server->sendContent_P(HTTP_END);
|
||||
|
||||
server->client().stop(); // Stop is needed because we sent no content length
|
||||
@@ -326,7 +328,7 @@ void WiFiManager::handleWifi(bool scan) {
|
||||
DEBUG_PRINT(F("Scan done"));
|
||||
if (n == 0) {
|
||||
DEBUG_PRINT(F("No networks found"));
|
||||
server->sendContent("<div>No networks found. Refresh to scan again.</div>");
|
||||
server->sendContent("No networks found. Refresh to scan again.");
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < n; ++i)
|
||||
@@ -347,6 +349,7 @@ void WiFiManager::handleWifi(bool scan) {
|
||||
server->sendContent(item);
|
||||
delay(0);
|
||||
}
|
||||
server->sendContent("<br/>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -23,14 +23,15 @@
|
||||
|
||||
const char HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
|
||||
//const char HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/><title>{v}</title>";
|
||||
const char HTTP_STYLE[] PROGMEM = "<style>div,input {margin-bottom: 5px;} body{width:200px;display:block;margin-left:auto;margin-right:auto;} button{padding:0.75rem 1rem;border:0;border-radius:0.317rem;background-color:#1fa3ec;color:#fff;line-height:1.5;cursor:pointer;}</style>";
|
||||
const char HTTP_STYLE[] PROGMEM = "<style>div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;}</style>";
|
||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();}</script>";
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body>";
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body><div style='text-align: left; display: inline-block;'>";
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"><button>Configure WiFi</button></form><br/><form action=\"/0wifi\" method=\"get\"><button>Configure WiFi (No Scan)</button></form>";
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#' onclick='c(this)'>{v}</a> {r}% {i}</div>";
|
||||
const char HTTP_ITEM_PADLOCK[] PROGMEM = "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAACVBMVEUAAAC7u7v///9etNz6AAAAJ0lEQVR4AY3GsREAIBSDUD77D63x4tlKw0MdmD0ijTO9f6SFnv7YXB4qAIVn0xoMAAAAAElFTkSuQmCC'/>";
|
||||
const char HTTP_FORM[] PROGMEM = "<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><input id='p' name='p' length=64 placeholder='password'><br/><button type='submit'>save</button></form>";
|
||||
const char HTTP_ITEM_PADLOCK[] PROGMEM = "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAKCAMAAAC+Ge+yAAAACVBMVEUAAAC7u7v///9etNz6AAAAI0lEQVQI133GsQ3AMAAEoXv2H9qNJacKFbEaWTQJ+uQB/nMdEaYAXeJkZ9AAAAAASUVORK5CYII='/>";
|
||||
const char HTTP_FORM[] PROGMEM = "<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><br/><input id='p' name='p' length=64 placeholder='password'><br/><br/><button type='submit'>save</button></form>";
|
||||
const char HTTP_SAVED[] PROGMEM = "<div>Credentials Saved<br />Trying to connect ESP to network.<br />If it fails reconnect to AP to try again</div>";
|
||||
const char HTTP_END[] PROGMEM = "</body></html>";
|
||||
const char HTTP_END[] PROGMEM = "</div></body></html>";
|
||||
|
||||
|
||||
class WiFiManager
|
||||
@@ -84,16 +85,16 @@ private:
|
||||
void begin(char const *apName);
|
||||
void begin(char const *apName, char const *apPasswd);
|
||||
|
||||
int _eepromStart;
|
||||
int _eepromStart;
|
||||
const char* _apName = "no-net";
|
||||
const char* _apPasswd = NULL;
|
||||
String _ssid = "";
|
||||
String _pass = "";
|
||||
String _ssid = "";
|
||||
String _pass = "";
|
||||
unsigned long timeout = 0;
|
||||
unsigned long start = 0;
|
||||
IPAddress _ip;
|
||||
IPAddress _gw;
|
||||
IPAddress _sn;
|
||||
IPAddress _ip;
|
||||
IPAddress _gw;
|
||||
IPAddress _sn;
|
||||
|
||||
String getEEPROMString(int start, int len);
|
||||
void setEEPROMString(int start, int len, String string);
|
||||
|
||||
Reference in New Issue
Block a user