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

Commit

Permalink
v1.7.1 to optimize code
Browse files Browse the repository at this point in the history
### Release v1.7.1

1. Optimize code
  • Loading branch information
khoih-prog committed Apr 27, 2022
1 parent e44933c commit 6f33d92
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 69 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ This [**WiFiManager_Generic_Lite** library](https://github.com/khoih-prog/WiFiMa
10. [`Earle Philhower's arduino-pico core v1.13.3+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
11. [`Functional-Vlpp library v1.0.2+`](https://github.com/khoih-prog/functional-vlpp) to use server's lambda function. To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/Functional-Vlpp.svg?)](https://www.ardu-badge.com/Functional-Vlpp)
12. [`WiFiNINA_Generic library v1.8.14-3+`](https://github.com/khoih-prog/WiFiNINA_Generic). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/WiFiNINA_Generic.svg?)](https://www.ardu-badge.com/WiFiNINA_Generic)
13. [`WiFiWebServer library v1.6.1+`](https://github.com/khoih-prog/WiFiWebServer). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/WiFiWebServer.svg?)](https://www.ardu-badge.com/WiFiWebServer)
13. [`WiFiWebServer library v1.8.0+`](https://github.com/khoih-prog/WiFiWebServer). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/WiFiWebServer.svg?)](https://www.ardu-badge.com/WiFiWebServer)
14. [`ESP8266_AT_WebServer library v1.5.4+`](https://github.com/khoih-prog/ESP8266_AT_WebServer) to be able to support ESP32-AT shields. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP8266_AT_WebServer.svg?)](https://www.ardu-badge.com/ESP8266_AT_WebServer)
15. [`ESP_AT_Lib library v1.4.1+`](https://github.com/khoih-prog/ESP_AT_Lib) if using ESP8288/ESP32-AT shields. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_AT_Lib.svg?)](https://www.ardu-badge.com/ESP_AT_Lib).
16. [`Modified WiFi101 Library v0.16.1+`](https://github.com/khoih-prog/WiFi101) to use SAMD MKR1000, etc. boards with WiFi101.
Expand Down Expand Up @@ -1181,7 +1181,7 @@ This is the terminal output when running [**SAMD_WiFi**](examples/SAMD_WiFi) exa

```
Start SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xffffffff
No doubleResetDetected
Expand Down Expand Up @@ -1282,7 +1282,7 @@ CCCCCCCCC

```
Start SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xd0d04321
No doubleResetDetected
Expand Down Expand Up @@ -1335,7 +1335,7 @@ HHHHHHHHHH HHHHHHHHHH

```
Start SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xd0d04321
No doubleResetDetected
Expand Down Expand Up @@ -1399,7 +1399,7 @@ CCCC

```
Start SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xd0d04321
No doubleResetDetected
Expand Down Expand Up @@ -1449,7 +1449,7 @@ HHHHHHHHH HHHHHHHHHH

```
Start SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xd0d01234
doubleResetDetected
Expand Down Expand Up @@ -1510,7 +1510,7 @@ This is the terminal output when running [**SAMD_WiFi**](examples/SAMD_WiFi) exa

```
Start SAMD_WiFi on ITSYBITSY_M4 with Custom using Custom WiFi Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[ESP_AT] Use ES8266-AT Command
WiFi shield init done
[WG] Hostname=SAMD-Master-Controller
Expand Down Expand Up @@ -1549,7 +1549,7 @@ C

```
Start SAMD_WiFi on ITSYBITSY_M4 with Custom using Custom WiFi Library
WiFiManager_Generic_Lite v1.7.0
WiFiManager_Generic_Lite v1.7.1
[ESP_AT] Use ES8266-AT Command
WiFi shield init done
[WG] Hostname=SAMD-Master-Controller
Expand Down
5 changes: 5 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)
* [Release v1.7.1](#release-v171)
* [Release v1.7.0](#release-v170)
* [Release v1.6.0](#release-v160)
* [Release v1.5.1](#release-v151)
Expand All @@ -33,6 +34,10 @@

## Changelog

### Release v1.7.1

1. Optimize code

### Release v1.7.0

1. Use [WiFiMulti_Generic](https://github.com/khoih-prog/WiFiMulti_Generic) library to connect to the best of **multi-WiFi APs**, with **auto-checking / auto-reconnecting** features when WiFi connection is lost.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WiFiManager_Generic_Lite",
"version": "1.7.0",
"version": "1.7.1",
"keywords": "wifi, multi-wifi, WiFiNINA, WiFi101, ESP32-AT, ESP8266-AT, Teensy, SAM-DUE, SAMD, STM32, nRF52, rpi-pico, rp2040, nano-rp2040-connect, config-portal, Double-Reset, dynamic-params, LittleFS, FlashStorage-SAMD, FlashStorage-STM32, Credentials, wi-fi, FlashStorage",
"description": "Library to configure MultiWiFi/Credentials at runtime for Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based (Nano RP2040 Connect, RASPBERRY_PI_PICO) boards, etc. using Generic WiFi (WiFiNINA, WiFi101, ESP8266-AT, ESP32-AT, etc.) modules/shields. You can also specify DHCP HostName, static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Credentials are saved in LittleFS/InternalFS, (emulated-)EEPROM, FlashStorage_SAMD, FlashStorage_STM32 or DueFlashStorage. New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. DoubleDetectDetector as well as Virtual Switches feature permits entering Config Portal as requested. Now using WiFiMulti_Generic library",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WiFiManager_Generic_Lite
version=1.7.0
version=1.7.1
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand Down
34 changes: 24 additions & 10 deletions src/WiFiManager_Generic_Lite_DUE.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite
Licensed under MIT license
Version: 1.7.0
Version: 1.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,7 +19,8 @@
1.5.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards
1.6.0 K Hoang 26/01/2022 Optional Board_Name in Menu. Optimize code by using passing by reference
Add optional CONFIG_MODE_LED. Add function isConfigMode()
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.1 K Hoang 27/04/2022 Optimize code
********************************************************************************************************************************/

#ifndef WiFiManager_Generic_Lite_DUE_h
Expand All @@ -36,13 +37,13 @@
#endif

#ifndef WIFI_MANAGER_GENERIC_LITE_VERSION
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.0"
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.1"

#define WIFI_MANAGER_GENERIC_LITE_VERSION_MAJOR 1
#define WIFI_MANAGER_GENERIC_LITE_VERSION_MINOR 7
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 0
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 1

#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007000
#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007001

#endif

Expand Down Expand Up @@ -407,8 +408,7 @@ class WiFiManager_Generic_Lite
hadConfigData = true;

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif

if (connectMultiWiFi(RETRY_TIMES_CONNECT_WIFI))
Expand Down Expand Up @@ -963,6 +963,21 @@ class WiFiManager_Generic_Lite
WG_LOGERROR3(F("SSID="), WiFi.SSID(), F(",RSSI="), WiFi.RSSI());
WG_LOGERROR1(F("IP="), localIP() );
}

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

#if (USE_WIFI_NINA || USE_WIFI101)

void wifiMulti_addAP()
{
for (uint8_t index = 0; index < NUM_WIFI_CREDENTIALS; index++)
{
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[index].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[index].wifi_pw);
}
}
#endif

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

#define WIFI_GENERIC_BOARD_TYPE "WIFI_GENERIC"
#define WM_NO_CONFIG "blank"
Expand Down Expand Up @@ -1325,9 +1340,8 @@ class WiFiManager_Generic_Lite
dueFlashStorage_putDynamicData();
#endif

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti_addAP();
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions src/WiFiManager_Generic_Lite_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite
Licensed under MIT license
Version: 1.7.0
Version: 1.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -20,7 +20,8 @@
1.5.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards
1.6.0 K Hoang 26/01/2022 Optional Board_Name in Menu. Optimize code by using passing by reference
Add optional CONFIG_MODE_LED. Add function isConfigMode()
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.1 K Hoang 27/04/2022 Optimize code
********************************************************************************************************************************/

#ifndef WiFiManager_Generic_Lite_Debug_h
Expand Down
36 changes: 25 additions & 11 deletions src/WiFiManager_Generic_Lite_RP2040.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite
Licensed under MIT license
Version: 1.7.0
Version: 1.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,7 +19,8 @@
1.5.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards
1.6.0 K Hoang 26/01/2022 Optional Board_Name in Menu. Optimize code by using passing by reference
Add optional CONFIG_MODE_LED. Add function isConfigMode()
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.1 K Hoang 27/04/2022 Optimize code
********************************************************************************************************************************/

#ifndef WiFiManager_Generic_Lite_RP2040_h
Expand All @@ -36,13 +37,13 @@
#endif

#ifndef WIFI_MANAGER_GENERIC_LITE_VERSION
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.0"
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.1"

#define WIFI_MANAGER_GENERIC_LITE_VERSION_MAJOR 1
#define WIFI_MANAGER_GENERIC_LITE_VERSION_MINOR 7
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 0
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 1

#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007000
#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007001

#endif

Expand Down Expand Up @@ -409,8 +410,7 @@ class WiFiManager_Generic_Lite
hadConfigData = true;

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif

if (connectMultiWiFi(RETRY_TIMES_CONNECT_WIFI))
Expand Down Expand Up @@ -1009,6 +1009,22 @@ class WiFiManager_Generic_Lite
WG_LOGERROR3(F("SSID="), WiFi.SSID(), F(",RSSI="), WiFi.RSSI());
WG_LOGERROR1(F("IP="), localIP() );
}

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

#if (USE_WIFI_NINA || USE_WIFI101)

void wifiMulti_addAP()
{
for (uint8_t index = 0; index < NUM_WIFI_CREDENTIALS; index++)
{
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[index].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[index].wifi_pw);
}
}
#endif

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


#define WIFI_GENERIC_BOARD_TYPE "WIFI_GENERIC"
#define WM_NO_CONFIG "blank"
Expand Down Expand Up @@ -1504,8 +1520,7 @@ class WiFiManager_Generic_Lite
#endif

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif
}

Expand Down Expand Up @@ -1987,8 +2002,7 @@ class WiFiManager_Generic_Lite
#endif

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif
}

Expand Down
33 changes: 24 additions & 9 deletions src/WiFiManager_Generic_Lite_SAMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite
Licensed under MIT license
Version: 1.7.0
Version: 1.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -19,7 +19,8 @@
1.5.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards
1.6.0 K Hoang 26/01/2022 Optional Board_Name in Menu. Optimize code by using passing by reference
Add optional CONFIG_MODE_LED. Add function isConfigMode()
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.0 K Hoang 27/04/2022 Use WiFiMulti_Generic library for auto-checking / auto-reconnecting MultiWiFi
1.7.1 K Hoang 27/04/2022 Optimize code
********************************************************************************************************************************/

#ifndef WiFiManager_Generic_Lite_SAMD_h
Expand All @@ -42,13 +43,13 @@
#endif

#ifndef WIFI_MANAGER_GENERIC_LITE_VERSION
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.0"
#define WIFI_MANAGER_GENERIC_LITE_VERSION "WiFiManager_Generic_Lite v1.7.1"

#define WIFI_MANAGER_GENERIC_LITE_VERSION_MAJOR 1
#define WIFI_MANAGER_GENERIC_LITE_VERSION_MINOR 7
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 0
#define WIFI_MANAGER_GENERIC_LITE_VERSION_PATCH 1

#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007000
#define WIFI_MANAGER_GENERIC_LITE_VERSION_INT 1007001

#endif

Expand Down Expand Up @@ -408,8 +409,7 @@ class WiFiManager_Generic_Lite
hadConfigData = true;

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif

if (connectMultiWiFi(RETRY_TIMES_CONNECT_WIFI))
Expand Down Expand Up @@ -991,6 +991,22 @@ class WiFiManager_Generic_Lite
WG_LOGERROR3(F("SSID="), WiFi.SSID(), F(",RSSI="), WiFi.RSSI());
WG_LOGERROR1(F("IP="), localIP() );
}

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

#if (USE_WIFI_NINA || USE_WIFI101)

void wifiMulti_addAP()
{
for (uint8_t index = 0; index < NUM_WIFI_CREDENTIALS; index++)
{
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[index].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[index].wifi_pw);
}
}
#endif

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


#define WIFI_GENERIC_BOARD_TYPE "WIFI_GENERIC"
#define WM_NO_CONFIG "blank"
Expand Down Expand Up @@ -1306,8 +1322,7 @@ class WiFiManager_Generic_Lite
#endif

#if (USE_WIFI_NINA || USE_WIFI101)
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[0].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[0].wifi_pw);
wifiMulti.addAP(WIFI_GENERIC_config.WiFi_Creds[1].wifi_ssid, WIFI_GENERIC_config.WiFi_Creds[1].wifi_pw);
wifiMulti_addAP();
#endif
}

Expand Down
Loading

0 comments on commit 6f33d92

Please sign in to comment.