diff --git a/lib/MyESP/MyESP.cpp b/lib/MyESP/MyESP.cpp index 2b7e63bb0..ea6e44581 100644 --- a/lib/MyESP/MyESP.cpp +++ b/lib/MyESP/MyESP.cpp @@ -467,6 +467,9 @@ void MyESP::_OTACallback() { EEPROMr.commit(); #endif + // stop the web server + webServer.close(); + if (_ota_pre_callback) { (_ota_pre_callback)(); // call custom function } @@ -1411,14 +1414,14 @@ void MyESP::_mqttConnect() { // Setup everything we need void MyESP::setWIFI(const char * wifi_ssid, const char * wifi_password, wifi_callback_f callback) { // Check SSID too long or missing - if (!wifi_ssid || *wifi_ssid == 0x00 || strlen(wifi_ssid) > MAX_STR_LEN) { + if (!wifi_ssid || *wifi_ssid == 0x00 || strlen(wifi_ssid) > MAX_SSID_LEN) { _wifi_ssid = NULL; } else { _wifi_ssid = strdup(wifi_ssid); } // Check PASS too long - if (!wifi_password || *wifi_ssid == 0x00 || strlen(wifi_password) > MAX_STR_LEN) { + if (!wifi_password || *wifi_ssid == 0x00 || strlen(wifi_password) > MAX_PWD_LEN) { _wifi_password = NULL; } else { _wifi_password = strdup(wifi_password); @@ -1959,6 +1962,8 @@ void MyESP::_webRootPage() { char s[1000] = {0}; strlcpy(s, webCommonPage_start, sizeof(s)); + strlcat(s, webCommonPage_start_refresh, sizeof(s)); + strlcat(s, webCommonPage_start_body, sizeof(s)); strlcat(s, "

", sizeof(s)); strlcat(s, _app_name, sizeof(s)); @@ -2012,6 +2017,7 @@ void MyESP::_webResetPage() { char s[1000] = {0}; strlcpy(s, webCommonPage_start, sizeof(s)); + strlcat(s, webCommonPage_start_body, sizeof(s)); strlcat(s, "

", sizeof(s)); strlcat(s, _app_name, sizeof(s)); @@ -2039,7 +2045,7 @@ void MyESP::_webResetPage() { } else { // Create a string containing all the arguments // Check to see if there are new values (also doubles to check the length of the new value is long enough) - if (webServer.arg("newssid").length() < MAX_STR_LEN) { + if (webServer.arg("newssid").length() < MAX_SSID_LEN) { if (webServer.arg("newssid").length() == 0) { _wifi_ssid = NULL; } else { @@ -2047,7 +2053,7 @@ void MyESP::_webResetPage() { } } - if (webServer.arg("newpassword").length() < MAX_STR_LEN) { + if (webServer.arg("newpassword").length() < MAX_PWD_LEN) { if (webServer.arg("newpassword").length() == 0) { _wifi_password = NULL; } else { @@ -2074,6 +2080,7 @@ void MyESP::_webResetAllPage() { char s[1000] = {0}; strlcpy(s, webCommonPage_start, sizeof(s)); + strlcat(s, webCommonPage_start_body, sizeof(s)); strlcat(s, "

", sizeof(s)); strlcat(s, _app_name, sizeof(s)); diff --git a/lib/MyESP/MyESP.h b/lib/MyESP/MyESP.h index ca2902ad3..e91203b3e 100644 --- a/lib/MyESP/MyESP.h +++ b/lib/MyESP/MyESP.h @@ -192,7 +192,8 @@ constexpr size_t ArraySize(T (&)[N]) { #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value // web min and max length of wifi ssid and password -#define MAX_STR_LEN 16 +#define MAX_SSID_LEN 32 +#define MAX_PWD_LEN 64 #define MYESP_BOOTUP_FLASHDELAY 50 // flash duration for LED at bootup sequence #define MYESP_BOOTUP_DELAY 2000 // time before we open the window to reset. This is to stop resetting values when uploading firmware via USB @@ -204,15 +205,18 @@ constexpr size_t ArraySize(T (&)[N]) { const char webCommonPage_start[] = "" "" "" - "" - ""; + "body {background-color: #FFA500;font: normal 18px Verdana, Arial, sans-serif;} "; + + +const char webCommonPage_start_refresh[] = ""; + +const char webCommonPage_start_body[] = ""; const char webCommonPage_end[] = ""; const char webResetPage_form[] = "
" - "" - "" + "" + "" "" "
"; diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 213dd17f4..554ce189a 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1575,7 +1575,7 @@ void WebCallback(char * body) { char buffer[MYESP_MAXCHARBUFFER] = {0}; uint8_t num_devices = ems_printDevices_s(buffer, MYESP_MAXCHARBUFFER); if (num_devices == 0) { - strlcat(body, "no compatible EMS devices detected yet. (wait a few seconds)", MYESP_MAXCHARBUFFER); + strlcat(body, "(any detected and compatible EMS devices will show up here)", MYESP_MAXCHARBUFFER); } else { strlcat(body, buffer, MYESP_MAXCHARBUFFER); } diff --git a/src/version.h b/src/version.h index f67796aa1..8cd9a181e 100644 --- a/src/version.h +++ b/src/version.h @@ -6,5 +6,5 @@ #pragma once #define APP_NAME "EMS-ESP" -#define APP_VERSION "1.8.1b6" +#define APP_VERSION "1.8.1b7" #define APP_HOSTNAME "ems-esp"