Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 41f6479

Browse files
authored
v1.12.2 to optimize code, etc.
### Releases v1.12.2 1. Optimize code by using passing by `reference` instead of by `value` 2. Delete all confusing, function-lacking `minimal` examples 3. Delete all `Modeless` examples 4. Display informational warnings only when `_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3`
1 parent 76ad904 commit 41f6479

10 files changed

+203
-1594
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Please ensure to specify the following:
2929
Arduino IDE version: 1.8.19
3030
ESP8266 Core Version 3.0.2
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3333
3434
Context:
3535
I encountered an endless loop while trying to connect to Local WiFi.
@@ -50,3 +50,4 @@ There are usually some outstanding feature requests in the [existing issues list
5050
### Sending Pull Requests
5151

5252
Pull Requests with changes and fixes are also welcome!
53+

README.md

Lines changed: 42 additions & 1416 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Releases v1.12.2](#releases-v1122)
1516
* [Releases v1.12.1](#releases-v1121)
1617
* [Releases v1.12.0](#releases-v1120)
1718
* [Releases v1.11.0](#releases-v1110)
@@ -49,6 +50,13 @@
4950

5051
## Changelog
5152

53+
### Releases v1.12.2
54+
55+
1. Optimize code by using passing by `reference` instead of by `value`
56+
2. Delete all confusing, function-lacking `minimal` examples
57+
3. Delete all `Modeless` examples
58+
4. Display informational warnings only when `_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3`
59+
5260
### Releases v1.12.1
5361

5462
1. Add LittleFS support to `ESP32-C3`.

library.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ESPAsync_WiFiManager",
3-
"version": "1.12.1",
3+
"version": "1.12.2",
44
"keywords": "wifi, WiFiManager, esp8266, esp32, esp32-s2, esp32-s3, esp32-c3, AsyncWebServer, Async-WiFiManager, MultiWiFi, Async, Communication, Credentials, Config-Portal, DoubleReset, MultiReset, littlefs, spiffs, dns-server, iot, eeprom",
55
"description": "ESP32 (including ESP32-S2, ESP32-S3 and ESP32-C3), ESP8266 WiFi Connection Manager using AsyncWebServer, with enhanced GUI and fallback Web ConfigPortal. This Library is used for configuring ESP32 (including ESP32-S2, ESP32-S3 and ESP32-C3), ESP8266 modules WiFi Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP channel. Now with MultiWiFi auto(Re)connect, configurable CORS Header and auto-Timezone features. Auto detect ESP32 core and use either built-in LittleFS or external LITTLEFS library",
66
"authors":
@@ -44,7 +44,7 @@
4444
{
4545
"owner": "khoih-prog",
4646
"name": "ESP_DoubleResetDetector",
47-
"version": ">=1.3.0",
47+
"version": ">=1.3.1",
4848
"platforms": ["espressif8266", "espressif32"]
4949
},
5050
{
@@ -58,5 +58,5 @@
5858
"frameworks": "*",
5959
"platforms": ["espressif8266", "espressif32"],
6060
"examples": "examples/*/*/*.ino",
61-
"headers": ["ESPAsync_WiFiManager.h", "ESPAsync_WiFiManager.hpp", "ESPAsync_WiFiManager-Impl.h"]
61+
"headers": ["ESPAsync_WiFiManager.h", "ESPAsync_WiFiManager.hpp"]
6262
}

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ESPAsync_WiFiManager
2-
version=1.12.1
2+
version=1.12.2
33
author=Khoi Hoang
44
maintainer=Khoi Hoang <[email protected]>
55
license=MIT
@@ -8,5 +8,5 @@ paragraph=This Library is used for configuring ESP32 (including ESP32-S2, ESP32-
88
category=Communication
99
url=https://github.com/khoih-prog/ESPAsync_WiFiManager
1010
architectures=esp8266,esp32
11-
depends=ESP Async WebServer,ESP AsyncTCP,AsyncTCP,ESP_DoubleResetDetector
12-
includes=ESPAsync_WiFiManager.h,ESPAsync_WiFiManager.hpp,ESPAsync_WiFiManager-Impl.h
11+
depends=ESP Async WebServer, ESP AsyncTCP, AsyncTCP, ESP_DoubleResetDetector
12+
includes=ESPAsync_WiFiManager.h, ESPAsync_WiFiManager.hpp

platformio/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ lib_deps =
3535
; ESP Async WebServer@>=1.2.3
3636
; ESPAsyncTCP@>=1.2.2
3737
; AsyncTCP@>=1.1.1
38-
; ESP_DoubleResetDetector@>=1.3.0
38+
; ESP_DoubleResetDetector@>=1.3.1
3939
; LittleFS_esp32@>=1.0.6
4040
; PlatformIO 5.x
4141
me-no-dev/ESP Async WebServer@>=1.2.3
4242
me-no-dev/ESPAsyncTCP@>=1.2.2
4343
me-no-dev/AsyncTCP@>=1.1.1
44-
khoih-prog/ESP_DoubleResetDetector@>=1.3.0
44+
khoih-prog/ESP_DoubleResetDetector@>=1.3.1
4545
lorol/LittleFS_esp32@>=1.0.6
4646

4747
build_flags =

src/ESPAsync_WiFiManager-Impl.h

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,18 @@
1414
Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager
1515
Licensed under MIT license
1616
17-
Version: 1.12.1
17+
Version: 1.12.2
1818
1919
Version Modified By Date Comments
2020
------- ----------- ---------- -----------
2121
1.0.11 K Hoang 21/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer. Bump up to v1.0.11
2222
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+
...
5024
1.10.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
5125
1.11.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
5226
1.12.0 K Hoang 10/02/2022 Add support to new ESP32-S3
5327
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`
5429
*****************************************************************************************************************************/
5530

5631
#pragma once
@@ -71,19 +46,22 @@ ESPAsync_WMParameter::ESPAsync_WMParameter(const char *custom)
7146
_customHTML = custom;
7247
}
7348

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)
7551
{
7652
init(id, placeholder, defaultValue, length, custom, labelPlacement);
7753
}
7854

7955
// KH, using struct
8056
ESPAsync_WMParameter::ESPAsync_WMParameter(const WMParam_Data& WMParam_data)
8157
{
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);
8360
}
8461
//////
8562

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)
8765
{
8866
_WMParam_data._id = id;
8967
_WMParam_data._placeholder = placeholder;
@@ -121,7 +99,7 @@ void ESPAsync_WMParameter::setWMParam_Data(const WMParam_Data& WMParam_data)
12199
memcpy(&_WMParam_data, &WMParam_data, sizeof(_WMParam_data));
122100
}
123101

124-
void ESPAsync_WMParameter::getWMParam_Data(WMParam_Data &WMParam_data)
102+
void ESPAsync_WMParameter::getWMParam_Data(WMParam_Data& WMParam_data)
125103
{
126104
LOGINFO(F("getWMParam_Data"));
127105

@@ -1150,7 +1128,7 @@ void ESPAsync_WiFiManager::startWPS()
11501128

11511129
//Convenient for debugging but wasteful of program space.
11521130
//Remove if short of space
1153-
const char* ESPAsync_WiFiManager::getStatus(int status)
1131+
const char* ESPAsync_WiFiManager::getStatus(const int& status)
11541132
{
11551133
switch (status)
11561134
{
@@ -1212,21 +1190,21 @@ void ESPAsync_WiFiManager::resetSettings()
12121190

12131191
//////////////////////////////////////////
12141192

1215-
void ESPAsync_WiFiManager::setTimeout(unsigned long seconds)
1193+
void ESPAsync_WiFiManager::setTimeout(const unsigned long& seconds)
12161194
{
12171195
setConfigPortalTimeout(seconds);
12181196
}
12191197

12201198
//////////////////////////////////////////
12211199

1222-
void ESPAsync_WiFiManager::setConfigPortalTimeout(unsigned long seconds)
1200+
void ESPAsync_WiFiManager::setConfigPortalTimeout(const unsigned long& seconds)
12231201
{
12241202
_configPortalTimeout = seconds * 1000;
12251203
}
12261204

12271205
//////////////////////////////////////////
12281206

1229-
void ESPAsync_WiFiManager::setConnectTimeout(unsigned long seconds)
1207+
void ESPAsync_WiFiManager::setConnectTimeout(const unsigned long& seconds)
12301208
{
12311209
_connectTimeout = seconds * 1000;
12321210
}
@@ -1239,7 +1217,7 @@ void ESPAsync_WiFiManager::setDebugOutput(bool debug)
12391217
//////////////////////////////////////////
12401218

12411219
// KH, To enable dynamic/random channel
1242-
int ESPAsync_WiFiManager::setConfigPortalChannel(int channel)
1220+
int ESPAsync_WiFiManager::setConfigPortalChannel(const int& channel)
12431221
{
12441222
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
12451223
// 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_
13021280

13031281
//////////////////////////////////////////
13041282

1305-
void ESPAsync_WiFiManager::getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig)
1283+
void ESPAsync_WiFiManager::getSTAStaticIPConfig(WiFi_STA_IPConfig& WM_STA_IPconfig)
13061284
{
13071285
LOGINFO(F("getSTAStaticIPConfig"));
13081286

@@ -1327,7 +1305,7 @@ void ESPAsync_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAdd
13271305

13281306
//////////////////////////////////////////
13291307

1330-
void ESPAsync_WiFiManager::setMinimumSignalQuality(int quality)
1308+
void ESPAsync_WiFiManager::setMinimumSignalQuality(const int& quality)
13311309
{
13321310
_minimumQuality = quality;
13331311
}
@@ -1341,7 +1319,7 @@ void ESPAsync_WiFiManager::setBreakAfterConfig(bool shouldBreak)
13411319

13421320
//////////////////////////////////////////
13431321

1344-
void ESPAsync_WiFiManager::reportStatus(String &page)
1322+
void ESPAsync_WiFiManager::reportStatus(String& page)
13451323
{
13461324
page += FPSTR(WM_HTTP_SCRIPT_NTP_MSG);
13471325

@@ -2250,7 +2228,8 @@ void ESPAsync_WiFiManager::setSaveConfigCallback(void(*func)())
22502228
//////////////////////////////////////////
22512229

22522230
// 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+
{
22542233
_customHeadElement = element;
22552234
}
22562235

@@ -2264,7 +2243,7 @@ void ESPAsync_WiFiManager::setRemoveDuplicateAPs(bool removeDuplicates)
22642243

22652244
//////////////////////////////////////////
22662245

2267-
int ESPAsync_WiFiManager::getRSSIasQuality(int RSSI)
2246+
int ESPAsync_WiFiManager::getRSSIasQuality(const int& RSSI)
22682247
{
22692248
int quality = 0;
22702249

src/ESPAsync_WiFiManager.h

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,18 @@
1414
Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager
1515
Licensed under MIT license
1616
17-
Version: 1.12.1
17+
Version: 1.12.2
1818
1919
Version Modified By Date Comments
2020
------- ----------- ---------- -----------
2121
1.0.11 K Hoang 21/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer. Bump up to v1.0.11
2222
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+
...
5024
1.10.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
5125
1.11.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
5226
1.12.0 K Hoang 10/02/2022 Add support to new ESP32-S3
5327
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`
5429
*****************************************************************************************************************************/
5530

5631
#pragma once

0 commit comments

Comments
 (0)