diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9959cee..1bf3381 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p Please ensure to specify the following: -* Arduino IDE version (e.g. 1.8.16) or Platform.io version -* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, STM32 core v2.1.0, etc.) +* Arduino IDE version (e.g. 1.8.19) or Platform.io version +* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, STM32 core v2.2.0, etc.) * Contextual information (e.g. what you were trying to achieve) * Simplest possible steps to reproduce * Anything that might be relevant in your opinion, such as: @@ -26,10 +26,10 @@ Please ensure to specify the following: ### Example ``` -Arduino IDE version: 1.8.16 -Arduino STM32 Core v2.1.0 +Arduino IDE version: 1.8.19 +Arduino STM32 Core v2.2.0 OS: Ubuntu 20.04 LTS -Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux +Linux xy-Inspiron-3593 5.4.0-92-generic #103-Ubuntu SMP Fri Nov 26 16:13:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Context: The board couldn't autoreconnect to Local Blynk Server after router power recycling. diff --git a/README.md b/README.md index fcd6b40..59841c2 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ * [8. For RP2040-based boards using Earle Philhower arduino-pico core](#8-for-rp2040-based-boards-using-earle-philhower-arduino-pico-core) * [8.1. To use BOARD_NAME](#81-to-use-board_name) * [8.2. To avoid compile error relating to microsecondsToClockCycles](#82-to-avoid-compile-error-relating-to-microsecondstoclockcycles) - * [9. For Portenta_H7 boards using Arduino IDE in Linux](#9-for-portenta_h7-boards-using-arduino-ide-in-linux) + * [9. For Portenta_H7 boards using Arduino IDE in Linux](#9-for-portenta_h7-boards-using-arduino-ide-in-linux) * [How It Works](#how-it-works) * [How to use](#how-to-use) * [1. Basic usage](#1-basic-usage) @@ -54,6 +54,9 @@ * [8.1 Enable auto-scan of WiFi networks for selection in Configuration Portal](#81-enable-auto-scan-of-wifi-networks-for-selection-in-configuration-portal) * [8.2 Disable manually input SSIDs](#82-disable-manually-input-ssids) * [8.3 Select maximum number of SSIDs in the list](#83-select-maximum-number-of-ssids-in-the-list) + * [9. To avoid blocking in loop when WiFi is lost](#9-To-avoid-blocking-in-loop-when-wifi-is-lost) + * [9.1 Max times to try WiFi per loop](#91-max-times-to-try-wifi-per-loop) + * [9.2 Interval between reconnection WiFi if lost](#92-interval-between-reconnection-wifi-if-lost) * [Important Notes for using Dynamic Parameters' ids](#important-notes-for-using-dynamic-parameters-ids) * [Examples](#examples) * [ 1. Mega_ESP8266Shield](examples/Mega_ESP8266Shield) @@ -186,19 +189,19 @@ This [**ESP_AT_WM_Lite** library](https://github.com/khoih-prog/ESP_AT_WM_Lite) ## Prerequisites - 1. [`Arduino IDE 1.8.16+` for Arduino](https://www.arduino.cc/en/Main/Software) + 1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [](https://github.com/arduino/Arduino/releases/latest) 2. [`Arduino AVR core 1.8.3+`](https://github.com/arduino/ArduinoCore-avr) for Arduino (Use Arduino Board Manager) for AVR boards. [](https://github.com/arduino/ArduinoCore-avr/releases/latest) - 3. [`Arduino Core for STM32 v2.1.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.). [](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest) + 3. [`Arduino Core for STM32 v2.2.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.). [](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest) 4. [`Teensy core 1.55+`](https://www.pjrc.com/teensy/td_download.html) for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) boards 5. [`Arduino SAM DUE core v1.6.12+`](https://github.com/arduino/ArduinoCore-sam) for SAM DUE ARM Cortex-M3 boards. - 6. [`Arduino SAMD core 1.8.11+`](https://github.com/arduino/ArduinoCore-samd) for SAMD ARM Cortex-M0+ boards. [](https://github.com/arduino/ArduinoCore-samd/releases/latest) + 6. [`Arduino SAMD core 1.8.12+`](https://github.com/arduino/ArduinoCore-samd) for SAMD ARM Cortex-M0+ boards. [](https://github.com/arduino/ArduinoCore-samd/releases/latest) 7. [`Adafruit SAMD core 1.7.5+`](https://github.com/adafruit/ArduinoCore-samd) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [](https://github.com/adafruit/ArduinoCore-samd/releases/latest) 8. [`Seeeduino SAMD core 1.8.2+`](https://github.com/Seeed-Studio/ArduinoCore-samd) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). [](https://github.com/Seeed-Studio/ArduinoCore-samd/releases/latest/) - 9. [`Adafruit nRF52 v1.1.0+`](https://github.com/adafruit/Adafruit_nRF52_Arduino) for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, **NINA_B302_ublox**, etc. [](https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/latest) -10. [`Arduino mbed_rp2040 core 2.5.2+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [](https://github.com/arduino/ArduinoCore-mbed/releases/latest) -11. [`Earle Philhower's arduino-pico core v1.9.5+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [](https://github.com/earlephilhower/arduino-pico/releases/latest) -12. [`ESP8266_AT_WebServer library v1.4.0+`](https://github.com/khoih-prog/ESP8266_AT_WebServer) to be able to support ESP32-AT shields. To install, check [](https://www.ardu-badge.com/ESP8266_AT_WebServer) -13. [`FlashStorage_SAMD library v1.2.0+`](https://github.com/khoih-prog/FlashStorage_SAMD) for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). To install, check [](https://www.ardu-badge.com/FlashStorage_SAMD) + 9. [`Adafruit nRF52 v1.2.0+`](https://github.com/adafruit/Adafruit_nRF52_Arduino) for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, **NINA_B302_ublox**, etc. [](https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/latest) +10. [`Arduino mbed_rp2040 core 2.6.1+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [](https://github.com/arduino/ArduinoCore-mbed/releases/latest) +11. [`Earle Philhower's arduino-pico core v1.9.13+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [](https://github.com/earlephilhower/arduino-pico/releases/latest) +12. [`ESP8266_AT_WebServer library v1.5.2+`](https://github.com/khoih-prog/ESP8266_AT_WebServer) to be able to support ESP32-AT shields. To install, check [](https://www.ardu-badge.com/ESP8266_AT_WebServer) +13. [`FlashStorage_SAMD library v1.2.1+`](https://github.com/khoih-prog/FlashStorage_SAMD) for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). To install, check [](https://www.ardu-badge.com/FlashStorage_SAMD) 14. [`FlashStorage_STM32 library v1.1.0+`](https://github.com/khoih-prog/FlashStorage_STM32) for STM32F/L/H/G/WB/MP1 boards. To install. check [](https://www.ardu-badge.com/FlashStorage_STM32) 15. [`DueFlashStorage library v1.0.0+`](https://github.com/sebnil/DueFlashStorage) for SAM DUE. To install, check [](https://www.ardu-badge.com/DueFlashStorage) 16. [`Adafruit's LittleFS/InternalFS`](www.adafruit.com) for nRF52 @@ -306,19 +309,19 @@ You can also use this link [ directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0). +**To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards**, you have to copy the whole [nRF52 Packages_Patches](Packages_Patches/adafruit/hardware/nrf52/1.2.0) directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0). -Supposing the Adafruit nRF52 version is 1.1.0. These files must be copied into the directory: -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/platform.txt` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/boards.txt` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Udp.h` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.h` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Print.cpp` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.h` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/variants/NINA_B302_ublox/variant.cpp` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.h` -- `~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/variants/NINA_B112_ublox/variant.cpp` -- **`~/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Udp.h`** +Supposing the Adafruit nRF52 version is 1.2.0. These files must be copied into the directory: +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/platform.txt` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/boards.txt` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.h` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.cpp` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.h` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.cpp` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.h` +- `~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.cpp` +- **`~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h`** Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory: @@ -336,14 +339,14 @@ These files must be copied into the directory: #### 2. For Teensy boards - **To be able to compile and run on Teensy boards**, you have to copy the files in [**Packages_Patches for Teensy directory**](Packages_Patches/hardware/teensy/avr) into Teensy hardware directory (./arduino-1.8.15/hardware/teensy/avr/boards.txt). + **To be able to compile and run on Teensy boards**, you have to copy the files in [**Packages_Patches for Teensy directory**](Packages_Patches/hardware/teensy/avr) into Teensy hardware directory (./arduino-1.8.19/hardware/teensy/avr/boards.txt). -Supposing the Arduino version is 1.8.15. These files must be copied into the directory: +Supposing the Arduino version is 1.8.19. These files must be copied into the directory: -- `./arduino-1.8.15/hardware/teensy/avr/boards.txt` -- `./arduino-1.8.15/hardware/teensy/avr/cores/teensy/Stream.h` -- `./arduino-1.8.15/hardware/teensy/avr/cores/teensy3/Stream.h` -- `./arduino-1.8.15/hardware/teensy/avr/cores/teensy4/Stream.h` +- `./arduino-1.8.19/hardware/teensy/avr/boards.txt` +- `./arduino-1.8.19/hardware/teensy/avr/cores/teensy/Stream.h` +- `./arduino-1.8.19/hardware/teensy/avr/cores/teensy3/Stream.h` +- `./arduino-1.8.19/hardware/teensy/avr/cores/teensy4/Stream.h` Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory: @@ -451,12 +454,12 @@ To use LAN8720 on some STM32 boards - **Discovery (DISCO_F746NG)** - **STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)** -you have to copy the files [stm32f4xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.1.0/system/STM32F4xx) and [stm32f7xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.1.0/system/STM32F7xx) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system) to overwrite the old files. +you have to copy the files [stm32f4xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.2.0/system/STM32F4xx) and [stm32f7xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.2.0/system/STM32F7xx) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system) to overwrite the old files. -Supposing the STM32 stm32 core version is 2.1.0. These files must be copied into the directory: +Supposing the STM32 stm32 core version is 2.2.0. These files must be copied into the directory: -- `~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h` for STM32F4. -- `~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h` for Nucleo-144 STM32F7. +- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h` for STM32F4. +- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h` for Nucleo-144 STM32F7. Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory: @@ -467,12 +470,12 @@ theses files must be copied into the corresponding directory: #### 7.2 For STM32 boards to use Serial1 -**To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards**, you have to copy the files [STM32 variant.h](Packages_Patches/STM32/hardware/stm32/2.1.0) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.1.0). You have to modify the files corresponding to your boards, this is just an illustration how to do. +**To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards**, you have to copy the files [STM32 variant.h](Packages_Patches/STM32/hardware/stm32/2.2.0) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.2.0). You have to modify the files corresponding to your boards, this is just an illustration how to do. -Supposing the STM32 stm32 core version is 2.1.0. These files must be copied into the directory: +Supposing the STM32 stm32 core version is 2.2.0. These files must be copied into the directory: -- `~/.arduino15/packages/STM32/hardware/stm32/2.1.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h` for Nucleo-144 NUCLEO_F767ZI. -- `~/.arduino15/packages/STM32/hardware/stm32/2.1.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h` for Nucleo-64 NUCLEO_L053R8. +- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h` for Nucleo-144 NUCLEO_F767ZI. +- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h` for Nucleo-64 NUCLEO_L053R8. Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory: @@ -515,12 +518,12 @@ With core after v1.5.0, this step is not necessary anymore thanks to the PR [Add #### 9. For Portenta_H7 boards using Arduino IDE in Linux - **To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.)**, you have to copy the file [portenta_post_install.sh](Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/portenta_post_install.sh) into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/2.4.1/portenta_post_install.sh). + **To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.)**, you have to copy the file [portenta_post_install.sh](Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh) into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh). Then run the following command using `sudo` ``` -$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/2.4.1 +$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1 $ chmod 755 portenta_post_install.sh $ sudo ./portenta_post_install.sh ``` @@ -533,9 +536,9 @@ This will create the file `/etc/udev/rules.d/49-portenta_h7.rules` as follows: SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666" ``` -Supposing the ArduinoCore-mbed core version is 2.4.1. Now only one file must be copied into the directory: +Supposing the ArduinoCore-mbed core version is 2.6.1. Now only one file must be copied into the directory: -- `~/.arduino15/packages/arduino/hardware/mbed_portenta/2.4.1/portenta_post_install.sh` +- `~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh` Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz @@ -744,6 +747,37 @@ The maximum number of SSIDs in the list is selectable from 2 to 6 for ESP8266/ES #define MAX_SSID_IN_LIST 8 ``` +#### 9. To avoid blocking in loop when WiFi is lost + + +#### 9.1 Max times to try WiFi per loop + +To define max times to try WiFi per loop() iteration. To avoid blocking issue in loop() + +Default is 1 if not defined, and minimum is forced to be 1. + +To use, uncomment in `defines.h`. + +Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/18#issue-1094004380) + +``` +#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 +``` + +#### 9.2 Interval between reconnection WiFi if lost + +Default is no interval between reconnection WiFi times if lost WiFi. Max permitted interval will be 10mins. + +Uncomment to use. Be careful, WiFi reconnection will be delayed if using this method. + +Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. + +Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/18#issuecomment-1006197561) + +``` +#define WIFI_RECON_INTERVAL 30000 // 30s +``` + --- --- @@ -1230,9 +1264,22 @@ void loop() // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// @@ -1418,7 +1465,7 @@ This is the terminal output when running [nRF52_ESP8266Shield](examples/nRF52_ES ``` Start nRF52_ESP8266Shield on NRF52840_FEATHER -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command LittleFS Flag read = 0xd0d01234 @@ -1458,7 +1505,7 @@ FFFF ``` Start nRF52_ESP8266Shield on NRF52840_FEATHER -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command LittleFS Flag read = 0xd0d04321 @@ -1494,7 +1541,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH ``` Start nRF52_ESP8266Shield on NRF52840_FEATHER -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command LittleFS Flag read = 0xd0d04321 @@ -1538,7 +1585,7 @@ This is the terminal output when running [SAMD_ESP8266Shield](examples/SAMD_ESP8 ``` Start SAMD_ESP8266Shield on ITSYBITSY_M4 -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command Flag read = 0xffffffff @@ -1578,7 +1625,7 @@ FFFF[ESP_AT] h:UpdFlash ``` Start SAMD_ESP8266Shield on ITSYBITSY_M4 -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command Flag read = 0xd0d04321 @@ -1606,7 +1653,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH ``` Start SAMD_ESP8266Shield on ITSYBITSY_M4 -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command Flag read = 0xd0d04321 @@ -1646,7 +1693,7 @@ This is the terminal output when running [RPi_Pico_ESP8266Shield](examples/RPi_P ``` Start RPi_Pico_ESP8266Shield on RASPBERRY_PI_PICO -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command LittleFS Flag read = 0xd0d04321 @@ -1688,7 +1735,7 @@ FFFFFFFFF FFFF ``` Start RPi_Pico_ESP8266Shield on RASPBERRY_PI_PICO -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 4 [ESP_AT] Use ES8266-AT Command LittleFS Flag read = 0xd0d04321 @@ -1755,7 +1802,7 @@ This is the terminal output when running [RPi_Pico_ESP8266Shield](examples/RPi_P ``` Start RPi_Pico_ESP8266Shield on MBED RASPBERRY_PI_PICO -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 3 [ESP_AT] Use ES8266-AT Command LittleFS size (KB) = 64 @@ -1799,7 +1846,7 @@ FFFFFFFFF FFFF ``` Start RPi_Pico_ESP8266Shield on MBED RASPBERRY_PI_PICO -ESP_AT_WM_Lite v1.4.1 +ESP_AT_WM_Lite v1.5.0 Debug Level = 4 [ESP_AT] Use ES8266-AT Command LittleFS size (KB) = 64 @@ -1905,6 +1952,7 @@ Submit issues to: [ESP_AT_WM_Lite issues](https://github.com/khoih-prog/ESP_AT_W 16. Add support to RP2040-based boards, such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, using [**Earle Philhower's arduino-pico** core](https://github.com/earlephilhower/arduino-pico). 17. Add support to RP2040-based boards, such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, using [**Arduino-mbed RP2040** core](https://github.com/arduino/ArduinoCore-mbed) 18. Add support to **Arduino Nano RP2040 Connect** using [**Arduino mbed OS for Nano boards**](https://github.com/arduino/ArduinoCore-mbed). +19. Fix the blocking issue in loop() with configurable `WIFI_RECON_INTERVAL` --- --- diff --git a/changelog.md b/changelog.md index e7a36ef..53bfdb6 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Release v1.5.0](#release-v150) * [Release v1.4.1](#release-v141) * [Major Release v1.4.0](#major-release-v140) * [Major Release v1.3.0](#major-release-v130) @@ -27,6 +28,12 @@ ## Changelog +### Release v1.5.0 + +1. Fix the blocking issue in loop(). Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/18) +2. Configurable `WIFI_RECON_INTERVAL`. Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/18#issuecomment-1006197561) +3. Update `Packages' Patches` + ### Release v1.4.1 1. Update `platform.ini` and `library.json` to use original `khoih-prog` instead of `khoih.prog` after PIO fix diff --git a/examples/Mega_ESP8266Shield/defines.h b/examples/Mega_ESP8266Shield/defines.h index 271247a..d285f22 100644 --- a/examples/Mega_ESP8266Shield/defines.h +++ b/examples/Mega_ESP8266Shield/defines.h @@ -46,13 +46,28 @@ #define BOARD_NAME BOARD_TYPE #endif +#define ESP_AT_USE_AVR true + // Start location in EEPROM to store config data. Default 0 // Config data Size currently is 116 bytes) #define EEPROM_START 0 ///////////////////////////////////////////// -#define USE_DYNAMIC_PARAMETERS false +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true + #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/examples/RPi_Pico_ESP8266Shield/defines.h b/examples/RPi_Pico_ESP8266Shield/defines.h index cc0abf0..8c93165 100644 --- a/examples/RPi_Pico_ESP8266Shield/defines.h +++ b/examples/RPi_Pico_ESP8266Shield/defines.h @@ -95,9 +95,22 @@ // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/examples/SAMD_ESP8266Shield/defines.h b/examples/SAMD_ESP8266Shield/defines.h index bf8494b..c7aa2a0 100644 --- a/examples/SAMD_ESP8266Shield/defines.h +++ b/examples/SAMD_ESP8266Shield/defines.h @@ -101,9 +101,22 @@ // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/examples/SAM_DUE_ESP8266Shield/defines.h b/examples/SAM_DUE_ESP8266Shield/defines.h index 0b4f1f6..2bd1fd4 100644 --- a/examples/SAM_DUE_ESP8266Shield/defines.h +++ b/examples/SAM_DUE_ESP8266Shield/defines.h @@ -59,11 +59,25 @@ #define EEPROM_START 0 ///////////////////////////////////////////// + // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/examples/STM32_ESP8266Shield/defines.h b/examples/STM32_ESP8266Shield/defines.h index 1fc2399..de1568d 100644 --- a/examples/STM32_ESP8266Shield/defines.h +++ b/examples/STM32_ESP8266Shield/defines.h @@ -126,9 +126,22 @@ // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/examples/nRF52_ESP8266Shield/defines.h b/examples/nRF52_ESP8266Shield/defines.h index f7196b3..7b1675d 100644 --- a/examples/nRF52_ESP8266Shield/defines.h +++ b/examples/nRF52_ESP8266Shield/defines.h @@ -83,9 +83,22 @@ // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank" // Default is false (if not defined) => must input 2 sets of SSID/PWD -#define REQUIRE_ONE_SET_SSID_PW false +#define REQUIRE_ONE_SET_SSID_PW true //false + +// Max times to try WiFi per loop() iteration. To avoid blocking issue in loop() +// Default 1 if not defined, and minimum 1. +//#define MAX_NUM_WIFI_RECON_TRIES_PER_LOOP 2 + +// Default no interval between recon WiFi if lost +// Max permitted interval will be 10mins +// Uncomment to use. Be careful, WiFi reconnect will be delayed if using this method +// Only use whenever urgent tasks in loop() can't be delayed. But if so, it's better you have to rewrite your code, e.g. using higher priority tasks. +#define WIFI_RECON_INTERVAL 30000 + +///////////////////////////////////////////// + +#define USE_DYNAMIC_PARAMETERS false //true -#define USE_DYNAMIC_PARAMETERS false #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD ///////////////////////////////////////////// diff --git a/library.json b/library.json index c153006..df3edbc 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESP_AT_WM_Lite", - "version": "1.4.1", + "version": "1.5.0", "keywords": "wifi, MultiWiFi, ESP8266-AT, ESP32-AT, SAM DUE, SAMD, nRF52, STM32, rpi-pico, rp2040, nano-rp2040-connect, Credentials, config-portal, dynamic-params, EEPROM, FlashStorage-SAMD, FlashStorage-STM32, LittleFS, DueFlashStorage, AVR Mega, Double-Reset, FlashStorage, light-weight", "description": "Light-Weight WiFi/Credentials Manager for AVR Mega, SAM DUE, SAMD21, SAMD51, nRF52, STM32, RP2040-based Nano_RP2040_connect, RASPBERRY_PI_PICO boards, etc. using ESP8266/ESP32-AT-command shields with web configuration portal. Powerful-yet-simple-to-use feature to enable adding dynamic custom parameters. You can also specify 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. Credentials and dynamic custom parameters are saved in EPROM, FlashStorage_SAMD, FlashStorage_STM32, DueFlashStorage or nRF52/RP2040 LittleFS.", "authors": @@ -39,7 +39,7 @@ { "owner": "khoih-prog", "name": "FlashStorage_SAMD", - "version": "^1.2.0", + "version": "^1.2.1", "platforms": ["*"] }, { @@ -51,7 +51,7 @@ { "owner": "khoih-prog", "name": "ESP8266_AT_WebServer", - "version": "^1.4.0", + "version": "^1.5.2", "platforms": ["*"] } ], diff --git a/library.properties b/library.properties index ea41dea..720835e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP_AT_WM_Lite -version=1.4.1 +version=1.5.0 author=Khoi Hoang maintainer=Khoi Hoang <khoih.prog@gmail.com> license=MIT diff --git a/platformio/platformio.ini b/platformio/platformio.ini index cea95fc..cced953 100644 --- a/platformio/platformio.ini +++ b/platformio/platformio.ini @@ -38,17 +38,17 @@ lib_compat_mode = strict lib_deps = ; PlatformIO 4.x -; ESP8266_AT_WebServer@~1.4.0 +; ESP8266_AT_WebServer@~1.5.2 ; DoubleResetDetector_Generic@~1.7.3 ; FlashStorage_STM32@~1.1.0 -; FlashStorage_SAMD@~1.2.0 +; FlashStorage_SAMD@~1.2.1 ; DueFlashStorage@~1.0.0 ; PlatformIO 5.x - khoih-prog/ESP8266_AT_WebServer@~1.4.0 + khoih-prog/ESP8266_AT_WebServer@~1.5.2 khoih-prog/DoubleResetDetector_Generic@~1.7.3 khoih-prog/FlashStorage_STM32@~1.1.0 - khoih-prog/FlashStorage_SAMD@~1.2.0 + khoih-prog/FlashStorage_SAMD@~1.2.1 sebnil/DueFlashStorage@~1.0.0 build_flags =