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

Commit

Permalink
v1.12.2 to optimize code, etc.
Browse files Browse the repository at this point in the history
### 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`
  • Loading branch information
khoih-prog authored Mar 13, 2022
1 parent 76ad904 commit 41f6479
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 1,594 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please ensure to specify the following:
Arduino IDE version: 1.8.19
ESP8266 Core Version 3.0.2
OS: Ubuntu 20.04 LTS
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
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
Context:
I encountered an endless loop while trying to connect to Local WiFi.
Expand All @@ -50,3 +50,4 @@ There are usually some outstanding feature requests in the [existing issues list
### Sending Pull Requests

Pull Requests with changes and fixes are also welcome!

1,458 changes: 42 additions & 1,416 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.12.2](#releases-v1122)
* [Releases v1.12.1](#releases-v1121)
* [Releases v1.12.0](#releases-v1120)
* [Releases v1.11.0](#releases-v1110)
Expand Down Expand Up @@ -49,6 +50,13 @@

## Changelog

### 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`

### Releases v1.12.1

1. Add LittleFS support to `ESP32-C3`.
Expand Down
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESPAsync_WiFiManager",
"version": "1.12.1",
"version": "1.12.2",
"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",
"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",
"authors":
Expand Down Expand Up @@ -44,7 +44,7 @@
{
"owner": "khoih-prog",
"name": "ESP_DoubleResetDetector",
"version": ">=1.3.0",
"version": ">=1.3.1",
"platforms": ["espressif8266", "espressif32"]
},
{
Expand All @@ -58,5 +58,5 @@
"frameworks": "*",
"platforms": ["espressif8266", "espressif32"],
"examples": "examples/*/*/*.ino",
"headers": ["ESPAsync_WiFiManager.h", "ESPAsync_WiFiManager.hpp", "ESPAsync_WiFiManager-Impl.h"]
"headers": ["ESPAsync_WiFiManager.h", "ESPAsync_WiFiManager.hpp"]
}
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESPAsync_WiFiManager
version=1.12.1
version=1.12.2
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand All @@ -8,5 +8,5 @@ paragraph=This Library is used for configuring ESP32 (including ESP32-S2, ESP32-
category=Communication
url=https://github.com/khoih-prog/ESPAsync_WiFiManager
architectures=esp8266,esp32
depends=ESP Async WebServer,ESP AsyncTCP,AsyncTCP,ESP_DoubleResetDetector
includes=ESPAsync_WiFiManager.h,ESPAsync_WiFiManager.hpp,ESPAsync_WiFiManager-Impl.h
depends=ESP Async WebServer, ESP AsyncTCP, AsyncTCP, ESP_DoubleResetDetector
includes=ESPAsync_WiFiManager.h, ESPAsync_WiFiManager.hpp
4 changes: 2 additions & 2 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ lib_deps =
; ESP Async WebServer@>=1.2.3
; ESPAsyncTCP@>=1.2.2
; AsyncTCP@>=1.1.1
; ESP_DoubleResetDetector@>=1.3.0
; ESP_DoubleResetDetector@>=1.3.1
; LittleFS_esp32@>=1.0.6
; PlatformIO 5.x
me-no-dev/ESP Async WebServer@>=1.2.3
me-no-dev/ESPAsyncTCP@>=1.2.2
me-no-dev/AsyncTCP@>=1.1.1
khoih-prog/ESP_DoubleResetDetector@>=1.3.0
khoih-prog/ESP_DoubleResetDetector@>=1.3.1
lorol/LittleFS_esp32@>=1.0.6

build_flags =
Expand Down
63 changes: 21 additions & 42 deletions src/ESPAsync_WiFiManager-Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager
Licensed under MIT license
Version: 1.12.1
Version: 1.12.2
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.11 K Hoang 21/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer. Bump up to v1.0.11
to sync with ESP_WiFiManager v1.0.11
1.1.1 K Hoang 29/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime to sync with
ESP_WiFiManager v1.1.1. Add setCORSHeader function to allow flexible CORS
1.1.2 K Hoang 17/09/2020 Fix bug in examples.
1.2.0 K Hoang 15/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.0 K Hoang 18/12/2020 Fix staticIP not saved. Add functions. Add complex examples.
1.4.1 K Hoang 21/12/2020 Fix bug and compiler warnings.
1.4.2 K Hoang 21/12/2020 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/12/2020 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 13/02/2021 Add support to new ESP32-S2. Optimize code.
1.6.0 K Hoang 25/02/2021 Fix WiFi Scanning bug.
1.6.1 K Hoang 26/03/2021 Modify multiWiFi-related timings to work better with latest esp32 core v1.0.6
1.6.2 K Hoang 08/04/2021 Fix example misleading messages.
1.6.3 K Hoang 13/04/2021 Allow captive portal to run more than once by closing dnsServer.
1.7.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
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
1.8.0 K Hoang 30/04/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.8.1 K Hoang 06/05/2021 Fix bug. Don't display invalid time when not synch yet.
1.9.0 K Hoang 08/05/2021 Add WiFi /scan page. Fix timezoneName not displayed in Info page. Clean up.
1.9.1 K Hoang 18/05/2021 Fix warnings with ESP8266 core v3.0.0
1.9.2 K Hoang 02/08/2021 Fix Mbed TLS compile error and MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.9.3 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.9.4 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.9.5 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.9.6 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.9.7 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80
1.9.8 K Hoang 01/12/2021 Fix bug returning IP `255.255.255.255` in core v2.0.0+ when using `hostname`
...
1.10.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.11.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.12.0 K Hoang 10/02/2022 Add support to new ESP32-S3
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+
1.12.2 K Hoang 13/03/2022 Optimize code by using passing by `reference` instead of by `value`
*****************************************************************************************************************************/

#pragma once
Expand All @@ -71,19 +46,22 @@ ESPAsync_WMParameter::ESPAsync_WMParameter(const char *custom)
_customHTML = custom;
}

ESPAsync_WMParameter::ESPAsync_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
ESPAsync_WMParameter::ESPAsync_WMParameter(const char *id, const char *placeholder, const char *defaultValue,
const int& length, const char *custom, const int& labelPlacement)
{
init(id, placeholder, defaultValue, length, custom, labelPlacement);
}

// KH, using struct
ESPAsync_WMParameter::ESPAsync_WMParameter(const WMParam_Data& WMParam_data)
{
init(WMParam_data._id, WMParam_data._placeholder, WMParam_data._value, WMParam_data._length, "", WMParam_data._labelPlacement);
init(WMParam_data._id, WMParam_data._placeholder, WMParam_data._value,
WMParam_data._length, "", WMParam_data._labelPlacement);
}
//////

void ESPAsync_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement)
void ESPAsync_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue,
const int& length, const char *custom, const int& labelPlacement)
{
_WMParam_data._id = id;
_WMParam_data._placeholder = placeholder;
Expand Down Expand Up @@ -121,7 +99,7 @@ void ESPAsync_WMParameter::setWMParam_Data(const WMParam_Data& WMParam_data)
memcpy(&_WMParam_data, &WMParam_data, sizeof(_WMParam_data));
}

void ESPAsync_WMParameter::getWMParam_Data(WMParam_Data &WMParam_data)
void ESPAsync_WMParameter::getWMParam_Data(WMParam_Data& WMParam_data)
{
LOGINFO(F("getWMParam_Data"));

Expand Down Expand Up @@ -1150,7 +1128,7 @@ void ESPAsync_WiFiManager::startWPS()

//Convenient for debugging but wasteful of program space.
//Remove if short of space
const char* ESPAsync_WiFiManager::getStatus(int status)
const char* ESPAsync_WiFiManager::getStatus(const int& status)
{
switch (status)
{
Expand Down Expand Up @@ -1212,21 +1190,21 @@ void ESPAsync_WiFiManager::resetSettings()

//////////////////////////////////////////

void ESPAsync_WiFiManager::setTimeout(unsigned long seconds)
void ESPAsync_WiFiManager::setTimeout(const unsigned long& seconds)
{
setConfigPortalTimeout(seconds);
}

//////////////////////////////////////////

void ESPAsync_WiFiManager::setConfigPortalTimeout(unsigned long seconds)
void ESPAsync_WiFiManager::setConfigPortalTimeout(const unsigned long& seconds)
{
_configPortalTimeout = seconds * 1000;
}

//////////////////////////////////////////

void ESPAsync_WiFiManager::setConnectTimeout(unsigned long seconds)
void ESPAsync_WiFiManager::setConnectTimeout(const unsigned long& seconds)
{
_connectTimeout = seconds * 1000;
}
Expand All @@ -1239,7 +1217,7 @@ void ESPAsync_WiFiManager::setDebugOutput(bool debug)
//////////////////////////////////////////

// KH, To enable dynamic/random channel
int ESPAsync_WiFiManager::setConfigPortalChannel(int channel)
int ESPAsync_WiFiManager::setConfigPortalChannel(const int& channel)
{
// 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
Expand Down Expand Up @@ -1302,7 +1280,7 @@ void ESPAsync_WiFiManager::setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_

//////////////////////////////////////////

void ESPAsync_WiFiManager::getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig)
void ESPAsync_WiFiManager::getSTAStaticIPConfig(WiFi_STA_IPConfig& WM_STA_IPconfig)
{
LOGINFO(F("getSTAStaticIPConfig"));

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

//////////////////////////////////////////

void ESPAsync_WiFiManager::setMinimumSignalQuality(int quality)
void ESPAsync_WiFiManager::setMinimumSignalQuality(const int& quality)
{
_minimumQuality = quality;
}
Expand All @@ -1341,7 +1319,7 @@ void ESPAsync_WiFiManager::setBreakAfterConfig(bool shouldBreak)

//////////////////////////////////////////

void ESPAsync_WiFiManager::reportStatus(String &page)
void ESPAsync_WiFiManager::reportStatus(String& page)
{
page += FPSTR(WM_HTTP_SCRIPT_NTP_MSG);

Expand Down Expand Up @@ -2250,7 +2228,8 @@ void ESPAsync_WiFiManager::setSaveConfigCallback(void(*func)())
//////////////////////////////////////////

// sets a custom element to add to head, like a new style tag
void ESPAsync_WiFiManager::setCustomHeadElement(const char* element) {
void ESPAsync_WiFiManager::setCustomHeadElement(const char* element)
{
_customHeadElement = element;
}

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

//////////////////////////////////////////

int ESPAsync_WiFiManager::getRSSIasQuality(int RSSI)
int ESPAsync_WiFiManager::getRSSIasQuality(const int& RSSI)
{
int quality = 0;

Expand Down
31 changes: 3 additions & 28 deletions src/ESPAsync_WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,18 @@
Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager
Licensed under MIT license
Version: 1.12.1
Version: 1.12.2
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.11 K Hoang 21/08/2020 Initial coding to use (ESP)AsyncWebServer instead of (ESP8266)WebServer. Bump up to v1.0.11
to sync with ESP_WiFiManager v1.0.11
1.1.1 K Hoang 29/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime to sync with
ESP_WiFiManager v1.1.1. Add setCORSHeader function to allow flexible CORS
1.1.2 K Hoang 17/09/2020 Fix bug in examples.
1.2.0 K Hoang 15/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
1.4.0 K Hoang 18/12/2020 Fix staticIP not saved. Add functions. Add complex examples.
1.4.1 K Hoang 21/12/2020 Fix bug and compiler warnings.
1.4.2 K Hoang 21/12/2020 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
1.4.3 K Hoang 23/12/2020 Fix examples' bug not saving Static IP in certain cases.
1.5.0 K Hoang 13/02/2021 Add support to new ESP32-S2. Optimize code.
1.6.0 K Hoang 25/02/2021 Fix WiFi Scanning bug.
1.6.1 K Hoang 26/03/2021 Modify multiWiFi-related timings to work better with latest esp32 core v1.0.6
1.6.2 K Hoang 08/04/2021 Fix example misleading messages.
1.6.3 K Hoang 13/04/2021 Allow captive portal to run more than once by closing dnsServer.
1.7.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
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
1.8.0 K Hoang 30/04/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
1.8.1 K Hoang 06/05/2021 Fix bug. Don't display invalid time when not synch yet.
1.9.0 K Hoang 08/05/2021 Add WiFi /scan page. Fix timezoneName not displayed in Info page. Clean up.
1.9.1 K Hoang 18/05/2021 Fix warnings with ESP8266 core v3.0.0
1.9.2 K Hoang 02/08/2021 Fix Mbed TLS compile error and MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
1.9.3 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
1.9.4 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.9.5 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
1.9.6 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
1.9.7 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80
1.9.8 K Hoang 01/12/2021 Fix bug returning IP `255.255.255.255` in core v2.0.0+ when using `hostname`
...
1.10.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
1.11.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
1.12.0 K Hoang 10/02/2022 Add support to new ESP32-S3
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+
1.12.2 K Hoang 13/03/2022 Optimize code by using passing by `reference` instead of by `value`
*****************************************************************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit 41f6479

Please sign in to comment.