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

Commit

Permalink
v1.1.0 to use FlashStorage_STM32, etc
Browse files Browse the repository at this point in the history
### Major Release v1.1.0

1. Use new efficient [**FlashStorage_STM32** library](https://github.com/khoih-prog/FlashStorage_STM32). 
2. Add support to new **STM32 core v2.0.0** and STM32L5
3. Permit auto-connect without waiting for Config Portal if stored data is valid and WiFi test connection is OK.
4. Update examples with new features
  • Loading branch information
khoih-prog authored Apr 28, 2021
1 parent 013d7e0 commit 9b17847
Show file tree
Hide file tree
Showing 20 changed files with 1,156 additions and 544 deletions.
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Contributing to ESP_WiFiManager
## Contributing to ESP_AT_WiFiManager

### Reporting Bugs

Please report bugs in ESP_WiFiManager if you find them.
Please report bugs in ESP_AT_WiFiManager if you find them.

However, before reporting a bug please check through the following:

* [Existing Open Issues](https://github.com/khoih-prog/ESP_WiFiManager/issues) - someone might have already encountered this.
* [Existing Open Issues](https://github.com/khoih-prog/ESP_AT_WiFiManager/issues) - someone might have already encountered this.

If you don't find anything, please [open a new issue](https://github.com/khoih-prog/ESP_WiFiManager/issues/new).
If you don't find anything, please [open a new issue](https://github.com/khoih-prog/ESP_AT_WiFiManager/issues/new).

### How to submit a bug report

Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.11) or Platform.io version
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v2.6.3 or ESP32 v1.0.4)
* Arduino IDE version (e.g. 1.8.13) or Platform.io version
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, STM32 core v2.0.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:
Expand All @@ -26,10 +26,10 @@ Please ensure to specify the following:
### Example

```
Arduino IDE version: 1.8.11
ESP8266 Core Version 2.6.3
OS: Ubuntu 16.04 LTS
Linux Inspiron 4.4.0-170-generic #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Arduino IDE version: 1.8.13
Arduino STM32 Core v2.0.0
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered an endless loop while trying to connect to Local WiFi.
Expand All @@ -44,7 +44,7 @@ Steps to reproduce:

Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.

There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/ESP_WiFiManager/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/ESP_AT_WiFiManager/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.

### Sending Pull Requests

Expand Down
575 changes: 443 additions & 132 deletions README.md

Large diffs are not rendered by default.

66 changes: 38 additions & 28 deletions examples/AutoConnect/AutoConnect.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/****************************************************************************************************************************
AutoConnect.ino
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.0.3
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
AutoConnect.ino
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.1.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
1.1.0 K Hoang 27/04/2021 Use new FlashStorage_STM32 library. Add support to new STM32 core v2.0.0 and STM32L5
*****************************************************************************************************************************/
// Credits of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip) for this simple yet effective method
// For some STM32, there is only definition of Serial in variant.h, and is used for Serial/USB Debugging
Expand All @@ -42,7 +43,7 @@

#include "defines.h"

void heartBeatPrint(void)
void heartBeatPrint()
{
static int num = 1;

Expand Down Expand Up @@ -75,7 +76,7 @@ void check_status()
}
}

void enterConfigPortal(void)
void enterConfigPortal()
{
//Local intialization. Once its business is done, there is no need to keep it around
ESP_AT_WiFiManager ESP_AT_wiFiManager;
Expand All @@ -99,13 +100,20 @@ void enterConfigPortal(void)
Router_SSID = ESP_AT_wiFiManager.WiFi_SSID();
Router_Pass = ESP_AT_wiFiManager.WiFi_Pass();

if (Router_SSID != "")
{
if ( (Router_SSID != "") && ESP_AT_wiFiManager.isWiFiConfigValid() )
{
if (ESP_AT_wiFiManager.connectWifi(Router_SSID, Router_Pass) == WL_CONNECTED)
{
Serial.println(F("Got stored Credentials. Try to connect first"));

return;
}

ESP_AT_wiFiManager.setConfigPortalTimeout(60); //If no access point name has been previously entered disable timeout.
Serial.println(F("Got stored Credentials. Timeout 60s"));
Serial.println(F("Got stored Credentials but can't connect. Timeout 60s"));
}
else
Serial.println(F("No stored Credentials. No timeout"));
Serial.println(F("No stored or not valid Credentials. No timeout"));

// SSID to uppercase
ssid.toUpperCase();
Expand Down Expand Up @@ -147,7 +155,9 @@ void setup()
#else
Serial.println("\nStart AutoConnect with ESP8266-AT WiFi module on " + String(BOARD_NAME));
#endif


Serial.println(ESP_AT_WIFIMANAGER_VERSION);

// initialize serial for ESP module
EspSerial.begin(115200);

Expand All @@ -164,8 +174,8 @@ void setup()

enterConfigPortal();

//if you get here you have connected to the WiFi
Serial.println("WiFi connected");
//if you get here you have exied from Config Portal
Serial.println("Exit Config Portal");
}

void loop()
Expand Down
39 changes: 17 additions & 22 deletions examples/AutoConnect/defines.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
/****************************************************************************************************************************
defines.h
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.0.3
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
defines.h
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down Expand Up @@ -59,9 +51,9 @@
#define ESP8266_AT_USE_SAM_DUE true
#endif

#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) )
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5) )
#if defined(ESP8266_AT_USE_STM32)
#undef ESP8266_AT_USE_STM32
#endif
Expand Down Expand Up @@ -288,6 +280,9 @@
#elif defined(STM32L4)
#warning STM32L4 board selected
#define BOARD_TYPE "STM32L4"
#elif defined(STM32L5)
#warning STM32L5 board selected
#define BOARD_TYPE "STM32L5"
#elif defined(STM32H7)
#warning STM32H7 board selected
#define BOARD_TYPE "STM32H7"
Expand Down
64 changes: 37 additions & 27 deletions examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/****************************************************************************************************************************
AutoConnectWithFeedBack.ino
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.0.3
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
AutoConnectWithFeedBack.ino
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.1.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
1.1.0 K Hoang 27/04/2021 Use new FlashStorage_STM32 library. Add support to new STM32 core v2.0.0 and STM32L5
*****************************************************************************************************************************/
// Credits of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip) for this simple yet effective method
// For some STM32, there is only definition of Serial in variant.h, and is used for Serial/USB Debugging
Expand All @@ -42,7 +43,7 @@

#include "defines.h"

void heartBeatPrint(void)
void heartBeatPrint()
{
static int num = 1;

Expand Down Expand Up @@ -81,7 +82,7 @@ void configModeCallback (ESP_AT_WiFiManager *myESP_WiFiManager)
Serial.println("AP_SSID : " + myESP_WiFiManager->getConfigPortalSSID() + " and AP_PASS = " + myESP_WiFiManager->getConfigPortalPW());
}

void enterConfigPortal(void)
void enterConfigPortal()
{
//Local intialization. Once its business is done, there is no need to keep it around
ESP_AT_WiFiManager ESP_AT_wiFiManager;
Expand All @@ -107,13 +108,20 @@ void enterConfigPortal(void)
Router_SSID = ESP_AT_wiFiManager.WiFi_SSID();
Router_Pass = ESP_AT_wiFiManager.WiFi_Pass();

if (Router_SSID != "")
{
if ( (Router_SSID != "") && ESP_AT_wiFiManager.isWiFiConfigValid() )
{
if (ESP_AT_wiFiManager.connectWifi(Router_SSID, Router_Pass) == WL_CONNECTED)
{
Serial.println(F("Got stored Credentials. Try to connect first"));

return;
}

ESP_AT_wiFiManager.setConfigPortalTimeout(60); //If no access point name has been previously entered disable timeout.
Serial.println(F("Got stored Credentials. Timeout 60s"));
Serial.println(F("Got stored Credentials but can't connect. Timeout 60s"));
}
else
Serial.println(F("No stored Credentials. No timeout"));
Serial.println(F("No stored or not valid Credentials. No timeout"));

// SSID to uppercase
ssid.toUpperCase();
Expand Down Expand Up @@ -156,6 +164,8 @@ void setup()
Serial.println("\nStart AutoConnectWithFeedBack with ESP8266-AT WiFi module on " + String(BOARD_NAME));
#endif

Serial.println(ESP_AT_WIFIMANAGER_VERSION);

// initialize serial for ESP module
EspSerial.begin(115200);

Expand All @@ -172,8 +182,8 @@ void setup()

enterConfigPortal();

//if you get here you have connected to the WiFi
Serial.println("WiFi connected");
//if you get here you have exied from Config Portal
Serial.println("Exit Config Portal");
}

void loop()
Expand Down
33 changes: 14 additions & 19 deletions examples/AutoConnectWithFeedback/defines.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
/****************************************************************************************************************************
defines.h
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
Version: 1.0.3
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 08/03/2020 Initial coding
1.0.1 K Hoang 22/06/2020 Add support to nRF52 boards, such as AdaFruit Feather nRF52832, NINA_B302_ublox, etc.
1.0.2 K Hoang 02/07/2020 Add support to ESP32-AT-command shields.
1.0.3 K Hoang 28/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 boards. Add Packages' Patches.
defines.h
WiFi/Credentials Manager for SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
ESP_AT_WiFiManager is a library for the Teensy, SAM DUE, SAMD, nRF52, STM32F/L/H/G/WB/MP1, etc. boards running `ESP8266/ESP32-AT-command` shields
(https://github.com/esp8266/Arduino) to enable easy configuration and reconfiguration of WiFi, etc. credentials using a Captive Portal
Based on and modified from Tzapu https://github.com/tzapu/WiFiManager
and from Ken Taylor https://github.com/kentaylor
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WiFiManager
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down Expand Up @@ -288,6 +280,9 @@
#elif defined(STM32L4)
#warning STM32L4 board selected
#define BOARD_TYPE "STM32L4"
#elif defined(STM32L5)
#warning STM32L5 board selected
#define BOARD_TYPE "STM32L5"
#elif defined(STM32H7)
#warning STM32H7 board selected
#define BOARD_TYPE "STM32H7"
Expand Down
Loading

0 comments on commit 9b17847

Please sign in to comment.