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

Commit 263f560

Browse files
authored
v1.2.0 to enable scan of WiFi networks
### Major Release v1.2.0 1. Enable scan of WiFi networks for selection in Configuration Portal. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](khoih-prog/WiFiManager_NINA_Lite#10). Now you can select optional **SCAN_WIFI_NETWORKS**, **MANUAL_SSID_INPUT_ALLOWED** to be able to manually input SSID, not only from a scanned SSID lists and **MAX_SSID_IN_LIST** (from 2-6 for ESP8266-AT or 2-15 for other) 2. Minor enhancement to not display garbage when data is invalid 3. Tested with new [Arduino Core for STM32 v2.0.0](https://github.com/stm32duino/Arduino_Core_STM32) and add support to new STM32L5 boards. 4. Enhance MultiWiFi connection logic 5. Enhance debugging feature
1 parent fdb5b46 commit 263f560

27 files changed

+2914
-742
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.13) or Platform.io version
18-
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP8266 core v2.7.4, etc.)
18+
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP8266 core v2.7.4, STM32 core v2.0.0, etc.)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -29,7 +29,7 @@ Please ensure to specify the following:
2929
Arduino IDE version: 1.8.13
3030
Arduino SAM DUE Core Version 1.6.12
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-71-generic #79-Ubuntu SMP Wed Mar 24 10:56:57 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
32+
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
3333
3434
Context:
3535
The board couldn't autoreconnect to Local Blynk Server after router power recycling.

README.md

Lines changed: 324 additions & 128 deletions
Large diffs are not rendered by default.

examples/Mega_ESP8266Shield/Mega_ESP8266Shield.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WM_Lite
1010
Licensed under MIT license
11-
Version: 1.1.0
11+
Version: 1.2.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -21,6 +21,7 @@
2121
1.0.4 K Hoang 03/07/2020 Add support to ESP32-AT shields. Modify LOAD_DEFAULT_CONFIG_DATA logic.
2222
Enhance MultiWiFi connection logic. Fix WiFi Status bug.
2323
1.1.0 K Hoang 13/04/2021 Fix invalid "blank" Config Data treated as Valid. Optional one set of WiFi Credentials
24+
1.2.0 Michael H 28/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
2425
*****************************************************************************************************************************/
2526

2627
#include "defines.h"
@@ -72,8 +73,10 @@ void setup()
7273
//delay(1000);
7374

7475
Serial.print(F("\nStart Mega_ESP8266Shield on "));
75-
Serial.println(BOARD_TYPE);
76+
Serial.println(BOARD_NAME);
7677
Serial.println(ESP_AT_WM_LITE_VERSION);
78+
Serial.print("Debug Level = ");
79+
Serial.println(_ESP_AT_WM_LOGLEVEL_);
7780

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

examples/Mega_ESP8266Shield/defines.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define ESP_AT_DEBUG_OUTPUT Serial
2424

2525
#define ESP_AT_DEBUG true
26+
#define _ESP_AT_WM_LOGLEVEL_ 3
2627

2728
// Uncomment to use ESP32-AT commands
2829
//#define USE_ESP32_AT true
@@ -41,12 +42,20 @@
4142
#define BOARD_TYPE "AVR Mega"
4243
#endif
4344

45+
#ifndef BOARD_NAME
46+
#define BOARD_NAME BOARD_TYPE
47+
#endif
48+
4449
// Start location in EEPROM to store config data. Default 0
4550
// Config data Size currently is 116 bytes)
4651
#define EEPROM_START 0
4752

4853
/////////////////////////////////////////////
4954

55+
// Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
56+
// Default is false (if not defined) => must input 2 sets of SSID/PWD
57+
#define REQUIRE_ONE_SET_SSID_PW false
58+
5059
#define USE_DYNAMIC_PARAMETERS true
5160

5261
/////////////////////////////////////////////

examples/SAMD_ESP8266Shield/SAMD_ESP8266Shield.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WM_Lite
1010
Licensed under MIT license
11-
Version: 1.1.0
11+
Version: 1.2.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -21,6 +21,7 @@
2121
1.0.4 K Hoang 03/07/2020 Add support to ESP32-AT shields. Modify LOAD_DEFAULT_CONFIG_DATA logic.
2222
Enhance MultiWiFi connection logic. Fix WiFi Status bug.
2323
1.1.0 K Hoang 13/04/2021 Fix invalid "blank" Config Data treated as Valid. Optional one set of WiFi Credentials
24+
1.2.0 Michael H 28/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
2425
*****************************************************************************************************************************/
2526

2627
#include "defines.h"
@@ -70,8 +71,10 @@ void setup()
7071
while (!Serial);
7172

7273
Serial.print("\nStart SAMD_ESP8266Shield on ");
73-
Serial.println(BOARD_TYPE);
74+
Serial.println(BOARD_NAME);
7475
Serial.println(ESP_AT_WM_LITE_VERSION);
76+
Serial.print("Debug Level = ");
77+
Serial.println(_ESP_AT_WM_LOGLEVEL_);
7578

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

examples/SAMD_ESP8266Shield/defines.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define ESP_AT_DEBUG_OUTPUT Serial
2424

2525
#define ESP_AT_DEBUG true
26+
#define _ESP_AT_WM_LOGLEVEL_ 3
2627

2728
// Uncomment to use ESP32-AT commands
2829
//#define USE_ESP32_AT true
@@ -88,6 +89,10 @@
8889

8990
#endif
9091

92+
#ifndef BOARD_NAME
93+
#define BOARD_NAME BOARD_TYPE
94+
#endif
95+
9196
// Start location in EEPROM to store config data. Default 0
9297
#define EEPROM_START 0
9398
#define EEPROM_SIZE (2 * 1024)
@@ -102,6 +107,16 @@
102107

103108
/////////////////////////////////////////////
104109

110+
#define SCAN_WIFI_NETWORKS true
111+
112+
// To be able to manually input SSID, not from a scanned SSID lists
113+
#define MANUAL_SSID_INPUT_ALLOWED true
114+
115+
// From 2-15
116+
#define MAX_SSID_IN_LIST 6
117+
118+
/////////////////////////////////////////////
119+
105120
#include <Esp8266_AT_WM_Lite_SAMD.h>
106121

107122
#define HOST_NAME "SAMD_ESP_AT"

examples/SAM_DUE_ESP8266Shield/SAM_DUE_ESP8266Shield.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WM_Lite
1010
Licensed under MIT license
11-
Version: 1.1.0
11+
Version: 1.2.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -21,6 +21,7 @@
2121
1.0.4 K Hoang 03/07/2020 Add support to ESP32-AT shields. Modify LOAD_DEFAULT_CONFIG_DATA logic.
2222
Enhance MultiWiFi connection logic. Fix WiFi Status bug.
2323
1.1.0 K Hoang 13/04/2021 Fix invalid "blank" Config Data treated as Valid. Optional one set of WiFi Credentials
24+
1.2.0 Michael H 28/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
2425
*****************************************************************************************************************************/
2526

2627
#include "defines.h"
@@ -70,8 +71,10 @@ void setup()
7071
while (!Serial);
7172

7273
Serial.print("\nStart SAM_DUE_ESP8266Shield on ");
73-
Serial.println(BOARD_TYPE);
74+
Serial.println(BOARD_NAME);
7475
Serial.println(ESP_AT_WM_LITE_VERSION);
76+
Serial.print("Debug Level = ");
77+
Serial.println(_ESP_AT_WM_LOGLEVEL_);
7578

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

examples/SAM_DUE_ESP8266Shield/defines.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define ESP_AT_DEBUG_OUTPUT Serial
2424

2525
#define ESP_AT_DEBUG true
26+
#define _ESP_AT_WM_LOGLEVEL_ 3
2627

2728
// Uncomment to use ESP32-AT commands
2829
//#define USE_ESP32_AT true
@@ -50,11 +51,14 @@
5051
#endif
5152
#endif
5253

54+
#ifndef BOARD_NAME
55+
#define BOARD_NAME BOARD_TYPE
56+
#endif
57+
5358
// Start location in EEPROM to store config data. Default 0
5459
#define EEPROM_START 0
5560

5661
/////////////////////////////////////////////
57-
5862
// Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
5963
// Default is false (if not defined) => must input 2 sets of SSID/PWD
6064
#define REQUIRE_ONE_SET_SSID_PW false
@@ -63,6 +67,16 @@
6367

6468
/////////////////////////////////////////////
6569

70+
#define SCAN_WIFI_NETWORKS true
71+
72+
// To be able to manually input SSID, not from a scanned SSID lists
73+
#define MANUAL_SSID_INPUT_ALLOWED true
74+
75+
// From 2-15
76+
#define MAX_SSID_IN_LIST 6
77+
78+
/////////////////////////////////////////////
79+
6680
#include <Esp8266_AT_WM_Lite_DUE.h>
6781

6882
#define HOST_NAME "SAM_DUE-ESP_AT"

examples/STM32_ESP8266Shield/STM32_ESP8266Shield.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Built by Khoi Hoang https://github.com/khoih-prog/ESP_AT_WM_Lite
1010
Licensed under MIT license
11-
Version: 1.1.0
11+
Version: 1.2.0
1212
1313
Version Modified By Date Comments
1414
------- ----------- ---------- -----------
@@ -20,7 +20,8 @@
2020
Add DRD support. Add MultiWiFi support
2121
1.0.4 K Hoang 03/07/2020 Add support to ESP32-AT shields. Modify LOAD_DEFAULT_CONFIG_DATA logic.
2222
Enhance MultiWiFi connection logic. Fix WiFi Status bug.
23-
1.1.0 K Hoang 13/04/2021 Fix invalid "blank" Config Data treated as Valid. Optional one set of WiFi Credentials
23+
1.1.0 K Hoang 13/04/2021 Fix invalid "blank" Config Data treated as Valid. Optional one set of WiFi Credentials
24+
1.2.0 Michael H 28/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
2425
*****************************************************************************************************************************/
2526

2627
#include "defines.h"
@@ -70,8 +71,10 @@ void setup()
7071
while (!Serial);
7172

7273
Serial.print("\nStart STM32_ESP8266Shield on ");
73-
Serial.println(BOARD_TYPE);
74+
Serial.println(BOARD_NAME);
7475
Serial.println(ESP_AT_WM_LITE_VERSION);
76+
Serial.print("Debug Level = ");
77+
Serial.println(_ESP_AT_WM_LOGLEVEL_);
7578

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

examples/STM32_ESP8266Shield/defines.h

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,101 @@
2323
#define ESP_AT_DEBUG_OUTPUT Serial
2424

2525
#define ESP_AT_DEBUG true
26+
#define _ESP_AT_WM_LOGLEVEL_ 3
2627

2728
// Uncomment to use ESP32-AT commands
2829
//#define USE_ESP32_AT true
2930

30-
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) )
31+
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
32+
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
33+
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5) )
3134
#if defined(ESP8266_AT_USE_STM32)
3235
#undef ESP8266_AT_USE_STM32
3336
#endif
3437
#define ESP8266_AT_USE_STM32 true
35-
#endif
36-
37-
#if ( defined(ESP8266) || defined(ESP32) || defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) || defined(CORE_TEENSY) || !(ESP8266_AT_USE_STM32) )
38-
#error This code is intended to run on STM32F platform! Please check your Tools->Board setting.
38+
#else
39+
#error This code is intended to run on STM32F platform! Please check your Tools->Board setting.
3940
#endif
4041

4142
#if ESP8266_AT_USE_STM32
4243
// For STM32, you have to declare and enable coreresponding Serial Port somewhere else before using it
4344
#define EspSerial Serial1
4445

4546
#if defined(STM32F0)
47+
#warning STM32F0 board selected
4648
#define BOARD_TYPE "STM32F0"
47-
#error Board STM32F0 not supported
4849
#elif defined(STM32F1)
50+
#warning STM32F1 board selected
4951
#define BOARD_TYPE "STM32F1"
5052
#elif defined(STM32F2)
53+
#warning STM32F2 board selected
5154
#define BOARD_TYPE "STM32F2"
5255
#elif defined(STM32F3)
56+
#warning STM32F3 board selected
5357
#define BOARD_TYPE "STM32F3"
5458
#elif defined(STM32F4)
59+
#warning STM32F4 board selected
5560
#define BOARD_TYPE "STM32F4"
5661
#elif defined(STM32F7)
57-
#define BOARD_TYPE "STM32F7"
62+
63+
#if defined(ARDUINO_NUCLEO_F767ZI)
64+
#warning Nucleo-144 NUCLEO_F767ZI board selected, using HardwareSerial Serial1 @ pin D0/RX and D1/TX
65+
// RX TX
66+
HardwareSerial Serial1(D0, D1);
67+
#else
68+
69+
#warning STM32F7 board selected
70+
#define BOARD_TYPE "STM32F7"
71+
72+
#endif
73+
74+
#elif defined(STM32L0)
75+
#if defined(ARDUINO_NUCLEO_L053R8)
76+
#warning Nucleo-64 NUCLEO_L053R8 board selected, using HardwareSerial Serial1 @ pin D0/RX and D1/TX
77+
// RX TX
78+
HardwareSerial Serial1(D0, D1); // (PA3, PA2);
79+
#else
80+
81+
#warning STM32L0 board selected
82+
#define BOARD_TYPE "STM32L0"
83+
84+
#endif
85+
86+
#elif defined(STM32L1)
87+
#warning STM32L1 board selected
88+
#define BOARD_TYPE "STM32L1"
89+
#elif defined(STM32L4)
90+
#warning STM32L4 board selected
91+
#define BOARD_TYPE "STM32L4"
92+
#elif defined(STM32L5)
93+
#warning STM32L5 board selected
94+
#define BOARD_TYPE "STM32L5"
95+
#elif defined(STM32H7)
96+
#warning STM32H7 board selected
97+
#define BOARD_TYPE "STM32H7"
98+
#elif defined(STM32G0)
99+
#warning STM32G0 board selected
100+
#define BOARD_TYPE "STM32G0"
101+
#elif defined(STM32G4)
102+
#warning STM32G4 board selected
103+
#define BOARD_TYPE "STM32G4"
104+
#elif defined(STM32WB)
105+
#warning STM32WB board selected
106+
#define BOARD_TYPE "STM32WB"
107+
#elif defined(STM32MP1)
108+
#warning STM32MP1 board selected
109+
#define BOARD_TYPE "STM32MP1"
58110
#else
59111
#warning STM32 unknown board selected
60112
#define BOARD_TYPE "STM32 Unknown"
61113
#endif
62114

63115
#endif
64116

117+
#ifndef BOARD_NAME
118+
#define BOARD_NAME BOARD_TYPE
119+
#endif
120+
65121
// Start location in EEPROM to store config data. Default 0
66122
// Config data Size currently is 128 bytes)
67123
#define EEPROM_START 0
@@ -76,6 +132,16 @@
76132

77133
/////////////////////////////////////////////
78134

135+
#define SCAN_WIFI_NETWORKS true
136+
137+
// To be able to manually input SSID, not from a scanned SSID lists
138+
#define MANUAL_SSID_INPUT_ALLOWED true
139+
140+
// From 2-15
141+
#define MAX_SSID_IN_LIST 6
142+
143+
/////////////////////////////////////////////
144+
79145
#include <Esp8266_AT_WM_Lite_STM32.h>
80146

81147

0 commit comments

Comments
 (0)