14
14
Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager
15
15
Licensed under MIT license
16
16
17
- Version: 1.12.1
17
+ Version: 1.12.2
18
18
19
19
Version Modified By Date Comments
20
20
------- ----------- ---------- -----------
21
21
1.0.11 K Hoang 21/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer. Bump up to v1.0.11
22
22
to sync with ESP_WiFiManager v1.0.11
23
- 1.1.1 K Hoang 29/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime to sync with
24
- ESP_WiFiManager v1.1.1. Add setCORSHeader function to allow flexible CORS
25
- 1.1.2 K Hoang 17/09/2020 Fix bug in examples.
26
- 1.2.0 K Hoang 15/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
27
- 1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
28
- 1.4.0 K Hoang 18/12/2020 Fix staticIP not saved. Add functions. Add complex examples.
29
- 1.4.1 K Hoang 21/12/2020 Fix bug and compiler warnings.
30
- 1.4.2 K Hoang 21/12/2020 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
31
- 1.4.3 K Hoang 23/12/2020 Fix examples' bug not saving Static IP in certain cases.
32
- 1.5.0 K Hoang 13/02/2021 Add support to new ESP32-S2. Optimize code.
33
- 1.6.0 K Hoang 25/02/2021 Fix WiFi Scanning bug.
34
- 1.6.1 K Hoang 26/03/2021 Modify multiWiFi-related timings to work better with latest esp32 core v1.0.6
35
- 1.6.2 K Hoang 08/04/2021 Fix example misleading messages.
36
- 1.6.3 K Hoang 13/04/2021 Allow captive portal to run more than once by closing dnsServer.
37
- 1.7.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
38
- 1.7.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
39
- 1.8.0 K Hoang 30/04/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
40
- 1.8.1 K Hoang 06/05/2021 Fix bug. Don't display invalid time when not synch yet.
41
- 1.9.0 K Hoang 08/05/2021 Add WiFi /scan page. Fix timezoneName not displayed in Info page. Clean up.
42
- 1.9.1 K Hoang 18/05/2021 Fix warnings with ESP8266 core v3.0.0
43
- 1.9.2 K Hoang 02/08/2021 Fix Mbed TLS compile error and MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
44
- 1.9.3 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
45
- 1.9.4 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
46
- 1.9.5 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
47
- 1.9.6 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
48
- 1.9.7 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80
49
- 1.9.8 K Hoang 01/12/2021 Fix bug returning IP `255.255.255.255` in core v2.0.0+ when using `hostname`
23
+ ...
50
24
1.10.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
51
25
1.11.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
52
26
1.12.0 K Hoang 10/02/2022 Add support to new ESP32-S3
53
27
1.12.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
28
+ 1.12.2 K Hoang 13/03/2022 Optimize code by using passing by `reference` instead of by `value`
54
29
*****************************************************************************************************************************/
55
30
56
31
#pragma once
@@ -71,19 +46,22 @@ ESPAsync_WMParameter::ESPAsync_WMParameter(const char *custom)
71
46
_customHTML = custom;
72
47
}
73
48
74
- ESPAsync_WMParameter::ESPAsync_WMParameter (const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
49
+ ESPAsync_WMParameter::ESPAsync_WMParameter (const char *id, const char *placeholder, const char *defaultValue,
50
+ const int & length, const char *custom, const int & labelPlacement)
75
51
{
76
52
init (id, placeholder, defaultValue, length, custom, labelPlacement);
77
53
}
78
54
79
55
// KH, using struct
80
56
ESPAsync_WMParameter::ESPAsync_WMParameter (const WMParam_Data& WMParam_data)
81
57
{
82
- init (WMParam_data._id , WMParam_data._placeholder , WMParam_data._value , WMParam_data._length , " " , WMParam_data._labelPlacement );
58
+ init (WMParam_data._id , WMParam_data._placeholder , WMParam_data._value ,
59
+ WMParam_data._length , " " , WMParam_data._labelPlacement );
83
60
}
84
61
// ////
85
62
86
- void ESPAsync_WMParameter::init (const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
63
+ void ESPAsync_WMParameter::init (const char *id, const char *placeholder, const char *defaultValue,
64
+ const int & length, const char *custom, const int & labelPlacement)
87
65
{
88
66
_WMParam_data._id = id;
89
67
_WMParam_data._placeholder = placeholder;
@@ -121,7 +99,7 @@ void ESPAsync_WMParameter::setWMParam_Data(const WMParam_Data& WMParam_data)
121
99
memcpy (&_WMParam_data, &WMParam_data, sizeof (_WMParam_data));
122
100
}
123
101
124
- void ESPAsync_WMParameter::getWMParam_Data (WMParam_Data & WMParam_data)
102
+ void ESPAsync_WMParameter::getWMParam_Data (WMParam_Data& WMParam_data)
125
103
{
126
104
LOGINFO (F (" getWMParam_Data" ));
127
105
@@ -1150,7 +1128,7 @@ void ESPAsync_WiFiManager::startWPS()
1150
1128
1151
1129
// Convenient for debugging but wasteful of program space.
1152
1130
// Remove if short of space
1153
- const char * ESPAsync_WiFiManager::getStatus (int status)
1131
+ const char * ESPAsync_WiFiManager::getStatus (const int & status)
1154
1132
{
1155
1133
switch (status)
1156
1134
{
@@ -1212,21 +1190,21 @@ void ESPAsync_WiFiManager::resetSettings()
1212
1190
1213
1191
// ////////////////////////////////////////
1214
1192
1215
- void ESPAsync_WiFiManager::setTimeout (unsigned long seconds)
1193
+ void ESPAsync_WiFiManager::setTimeout (const unsigned long & seconds)
1216
1194
{
1217
1195
setConfigPortalTimeout (seconds);
1218
1196
}
1219
1197
1220
1198
// ////////////////////////////////////////
1221
1199
1222
- void ESPAsync_WiFiManager::setConfigPortalTimeout (unsigned long seconds)
1200
+ void ESPAsync_WiFiManager::setConfigPortalTimeout (const unsigned long & seconds)
1223
1201
{
1224
1202
_configPortalTimeout = seconds * 1000 ;
1225
1203
}
1226
1204
1227
1205
// ////////////////////////////////////////
1228
1206
1229
- void ESPAsync_WiFiManager::setConnectTimeout (unsigned long seconds)
1207
+ void ESPAsync_WiFiManager::setConnectTimeout (const unsigned long & seconds)
1230
1208
{
1231
1209
_connectTimeout = seconds * 1000 ;
1232
1210
}
@@ -1239,7 +1217,7 @@ void ESPAsync_WiFiManager::setDebugOutput(bool debug)
1239
1217
// ////////////////////////////////////////
1240
1218
1241
1219
// KH, To enable dynamic/random channel
1242
- int ESPAsync_WiFiManager::setConfigPortalChannel (int channel)
1220
+ int ESPAsync_WiFiManager::setConfigPortalChannel (const int & channel)
1243
1221
{
1244
1222
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
1245
1223
// If channel == 0 => will use random channel from MIN_WIFI_CHANNEL to MAX_WIFI_CHANNEL
@@ -1302,7 +1280,7 @@ void ESPAsync_WiFiManager::setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_
1302
1280
1303
1281
// ////////////////////////////////////////
1304
1282
1305
- void ESPAsync_WiFiManager::getSTAStaticIPConfig (WiFi_STA_IPConfig & WM_STA_IPconfig)
1283
+ void ESPAsync_WiFiManager::getSTAStaticIPConfig (WiFi_STA_IPConfig& WM_STA_IPconfig)
1306
1284
{
1307
1285
LOGINFO (F (" getSTAStaticIPConfig" ));
1308
1286
@@ -1327,7 +1305,7 @@ void ESPAsync_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAdd
1327
1305
1328
1306
// ////////////////////////////////////////
1329
1307
1330
- void ESPAsync_WiFiManager::setMinimumSignalQuality (int quality)
1308
+ void ESPAsync_WiFiManager::setMinimumSignalQuality (const int & quality)
1331
1309
{
1332
1310
_minimumQuality = quality;
1333
1311
}
@@ -1341,7 +1319,7 @@ void ESPAsync_WiFiManager::setBreakAfterConfig(bool shouldBreak)
1341
1319
1342
1320
// ////////////////////////////////////////
1343
1321
1344
- void ESPAsync_WiFiManager::reportStatus (String & page)
1322
+ void ESPAsync_WiFiManager::reportStatus (String& page)
1345
1323
{
1346
1324
page += FPSTR (WM_HTTP_SCRIPT_NTP_MSG);
1347
1325
@@ -2250,7 +2228,8 @@ void ESPAsync_WiFiManager::setSaveConfigCallback(void(*func)())
2250
2228
// ////////////////////////////////////////
2251
2229
2252
2230
// sets a custom element to add to head, like a new style tag
2253
- void ESPAsync_WiFiManager::setCustomHeadElement (const char * element) {
2231
+ void ESPAsync_WiFiManager::setCustomHeadElement (const char * element)
2232
+ {
2254
2233
_customHeadElement = element;
2255
2234
}
2256
2235
@@ -2264,7 +2243,7 @@ void ESPAsync_WiFiManager::setRemoveDuplicateAPs(bool removeDuplicates)
2264
2243
2265
2244
// ////////////////////////////////////////
2266
2245
2267
- int ESPAsync_WiFiManager::getRSSIasQuality (int RSSI)
2246
+ int ESPAsync_WiFiManager::getRSSIasQuality (const int & RSSI)
2268
2247
{
2269
2248
int quality = 0 ;
2270
2249
0 commit comments