\
\
"; // DO NOT CHANGE THIS STRING EVER!!!!
+#else
+const char ESP_WM_LITE_HTML_HEAD_END[] /*PROGMEM*/ = "
\
+
"; // DO NOT CHANGE THIS STRING EVER!!!!
+#endif
const char ESP_WM_LITE_HTML_INPUT_ID[] /*PROGMEM*/ = "
";
const char ESP_WM_LITE_HTML_INPUT_ID1[] /*PROGMEM*/ = "
";
@@ -399,12 +414,21 @@ const char ESP_WM_LITE_FLDSET_START[] /*PROGMEM*/ = "
";
const char ESP_WM_LITE_HTML_PARAM[] /*PROGMEM*/ = "
";
const char ESP_WM_LITE_HTML_BUTTON[] /*PROGMEM*/ = "
";
+
+#if USING_BOARD_NAME
const char ESP_WM_LITE_HTML_SCRIPT[] /*PROGMEM*/ = "";
@@ -438,7 +462,7 @@ const char WM_HTTP_CORS_ALLOW_ALL[] /*PROGMEM*/ = "*";
//////////////////////////////////////////
-String IPAddressToString(IPAddress _address)
+String IPAddressToString(const IPAddress& _address)
{
String str = String(_address[0]);
str += ".";
@@ -889,14 +913,14 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- void setConfigPortalIP(IPAddress portalIP = IPAddress(192, 168, 4, 1))
+ void setConfigPortalIP(const IPAddress& portalIP = IPAddress(192, 168, 4, 1))
{
portal_apIP = portalIP;
}
//////////////////////////////////////////////
- void setConfigPortal(String ssid = "", String pass = "")
+ void setConfigPortal(const String& ssid = "", const String& pass = "")
{
portal_ssid = ssid;
portal_pass = pass;
@@ -907,7 +931,7 @@ class ESP_WiFiManager_Lite
#define MIN_WIFI_CHANNEL 1
#define MAX_WIFI_CHANNEL 11 // Channel 13 is flaky, because of bad number 13 ;-)
- int setConfigPortalChannel(int channel = 1)
+ int setConfigPortalChannel(const int& channel = 1)
{
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
// If channel == 0 => will use random channel from MIN_WIFI_CHANNEL to MAX_WIFI_CHANNEL
@@ -922,9 +946,10 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn = IPAddress(255, 255, 255, 0),
- IPAddress dns_address_1 = IPAddress(0, 0, 0, 0),
- IPAddress dns_address_2 = IPAddress(0, 0, 0, 0))
+ void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw,
+ const IPAddress& sn = IPAddress(255, 255, 255, 0),
+ const IPAddress& dns_address_1 = IPAddress(0, 0, 0, 0),
+ const IPAddress& dns_address_2 = IPAddress(0, 0, 0, 0))
{
static_IP = ip;
static_GW = gw;
@@ -945,7 +970,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- String getWiFiSSID(uint8_t index)
+ String getWiFiSSID(const uint8_t& index)
{
if (index >= NUM_WIFI_CREDENTIALS)
return String("");
@@ -958,7 +983,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- String getWiFiPW(uint8_t index)
+ String getWiFiPW(const uint8_t& index)
{
if (index >= NUM_WIFI_CREDENTIALS)
return String("");
@@ -1035,6 +1060,13 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
+ bool isConfigMode()
+ {
+ return configuration_mode;
+ }
+
+ //////////////////////////////////////////////
+
// Forced CP => Flag = 0xBEEFBEEF. Else => No forced CP
// Flag to be stored at (EEPROM_START + DRD_FLAG_DATA_SIZE + CONFIG_DATA_SIZE)
// to avoid corruption to current data
@@ -1245,7 +1277,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////
- void displayConfigData(ESP_WM_LITE_Configuration configData)
+ void displayConfigData(const ESP_WM_LITE_Configuration& configData)
{
ESP_WML_LOGERROR5(F("Hdr="), configData.header, F(",SSID="), configData.WiFi_Creds[0].wifi_ssid,
F(",PW="), configData.WiFi_Creds[0].wifi_pw);
@@ -1338,7 +1370,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- void saveForcedCP(uint32_t value)
+ void saveForcedCP(const uint32_t& value)
{
File file = FileFS.open(CONFIG_PORTAL_FILENAME, "w");
@@ -1374,7 +1406,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- void setForcedCP(bool isPersistent)
+ void setForcedCP(const bool& isPersistent)
{
uint32_t readForcedConfigPortalFlag = isPersistent? FORCED_PERS_CONFIG_PORTAL_FLAG_DATA : FORCED_CONFIG_PORTAL_FLAG_DATA;
@@ -1476,6 +1508,7 @@ class ESP_WiFiManager_Lite
// We dont like to destroy myMenuItems[i].pdata with invalid data
uint16_t maxBufferLength = 0;
+
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
if (myMenuItems[i].maxlen > maxBufferLength)
@@ -1976,7 +2009,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////////
- void setForcedCP(bool isPersistent)
+ void setForcedCP(const bool& isPersistent)
{
uint32_t readForcedConfigPortalFlag = isPersistent? FORCED_PERS_CONFIG_PORTAL_FLAG_DATA : FORCED_CONFIG_PORTAL_FLAG_DATA;
@@ -2573,7 +2606,10 @@ class ESP_WiFiManager_Lite
result.replace("[[pw]]", ESP_WM_LITE_config.WiFi_Creds[0].wifi_pw);
result.replace("[[id1]]", ESP_WM_LITE_config.WiFi_Creds[1].wifi_ssid);
result.replace("[[pw1]]", ESP_WM_LITE_config.WiFi_Creds[1].wifi_pw);
+
+#if USING_BOARD_NAME
result.replace("[[nm]]", ESP_WM_LITE_config.board_name);
+#endif
}
else
{
@@ -2581,7 +2617,10 @@ class ESP_WiFiManager_Lite
result.replace("[[pw]]", "");
result.replace("[[id1]]", "");
result.replace("[[pw1]]", "");
+
+#if USING_BOARD_NAME
result.replace("[[nm]]", "");
+#endif
}
#if USE_DYNAMIC_PARAMETERS
@@ -2633,7 +2672,10 @@ class ESP_WiFiManager_Lite
static bool pw_Updated = false;
static bool id1_Updated = false;
static bool pw1_Updated = false;
+
+#if USING_BOARD_NAME
static bool nm_Updated = false;
+#endif
if (!id_Updated && (key == String("id")))
{
@@ -2683,18 +2725,19 @@ class ESP_WiFiManager_Lite
else
strncpy(ESP_WM_LITE_config.WiFi_Creds[1].wifi_pw, value.c_str(), sizeof(ESP_WM_LITE_config.WiFi_Creds[1].wifi_pw) - 1);
}
+#if USING_BOARD_NAME
else if (!nm_Updated && (key == String("nm")))
{
ESP_WML_LOGDEBUG(F("h:repl nm"));
nm_Updated = true;
number_items_Updated++;
-
if (strlen(value.c_str()) < sizeof(ESP_WM_LITE_config.board_name) - 1)
strcpy(ESP_WM_LITE_config.board_name, value.c_str());
else
strncpy(ESP_WM_LITE_config.board_name, value.c_str(), sizeof(ESP_WM_LITE_config.board_name) - 1);
- }
+ }
+#endif
#if USE_DYNAMIC_PARAMETERS
else
@@ -2870,7 +2913,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////
- void setMinimumSignalQuality(int quality)
+ void setMinimumSignalQuality(const int& quality)
{
_minimumQuality = quality;
}
@@ -2878,7 +2921,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////
//if this is true, remove duplicate Access Points - default true
- void setRemoveDuplicateAPs(bool removeDuplicates)
+ void setRemoveDuplicateAPs(const bool& removeDuplicates)
{
_removeDuplicateAPs = removeDuplicates;
}
@@ -2998,7 +3041,7 @@ class ESP_WiFiManager_Lite
//////////////////////////////////////////
- int getRSSIasQuality(int RSSI)
+ int getRSSIasQuality(const int& RSSI)
{
int quality = 0;
diff --git a/src/ESP_WiFiManager_Lite_Debug.h b/src/ESP_WiFiManager_Lite_Debug.h
index bf85255..63dd316 100644
--- a/src/ESP_WiFiManager_Lite_Debug.h
+++ b/src/ESP_WiFiManager_Lite_Debug.h
@@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager_Lite
Licensed under MIT license
- Version: 1.8.1
+ Version: 1.8.2
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -23,7 +23,8 @@
1.6.0 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library. Fix bug.
1.7.0 K Hoang 08/01/2022 Fix the blocking issue in loop() with configurable WIFI_RECON_INTERVAL
1.8.0 K Hoang 10/02/2022 Add support to new ESP32-S3
- 1.8.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
+ 1.8.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
+ 1.8.2 K Hoang 21/02/2022 Optional Board_Name in Menu. Optimize code by using passing by reference
*****************************************************************************************************************************/
#ifndef ESP_WiFiManager_Lite_Debug_h