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

Commit ce798e2

Browse files
authored
v1.8.2 to optimize code, etc.
### Release v1.8.2 1. Optimize code by using passing by `reference` instead of by `value` 2. Optional `Board_Name` in Menu. Check [option to remove board name from web page #25](khoih-prog/WiFiManager_NINA_Lite#25) 3. Add function `isConfigMode()` to signal system is in Config Portal mode.
1 parent 98490f4 commit ce798e2

12 files changed

+180
-66
lines changed

CONTRIBUTING.md

+4-3
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.19) or Platform.io version
18-
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v3.0.2 or ESP32 v2.0.2)
18+
* Board Core Version (e.g. ESP8266 core v3.0.2, ESP32 core v2.0.2)
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:
@@ -27,9 +27,10 @@ Please ensure to specify the following:
2727

2828
```
2929
Arduino IDE version: 1.8.19
30-
ESP8266 Core Version 3.0.2
30+
ESP32_DEV board
31+
ESP32 core v2.0.2
3132
OS: Ubuntu 20.04 LTS
32-
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
33+
Linux xy-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3334
3435
Context:
3536
The board couldn't autoreconnect to Local Blynk Server after router power recycling.

README.md

+60-27
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
77
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP_WiFiManager_Lite.svg)](http://github.com/khoih-prog/ESP_WiFiManager_Lite/issues)
88

9-
<a href="https://www.buymeacoffee.com/khoihprog6" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 50px !important;width: 181px !important;" ></a>
9+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
10+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
1011

1112
---
1213
---
@@ -49,6 +50,7 @@
4950
* [13. To avoid blocking in loop when WiFi is lost](#13-To-avoid-blocking-in-loop-when-wifi-is-lost)
5051
* [13.1 Max times to try WiFi per loop](#131-max-times-to-try-wifi-per-loop)
5152
* [13.2 Interval between reconnection WiFi if lost](#132-interval-between-reconnection-wifi-if-lost)
53+
* [14. Not using Board_Name on Config_Portal](#14-Not-using-Board_Name-on-Config_Portal)
5254
* [Examples](#examples)
5355
* [ 1. ESP_WiFi](examples/ESP_WiFi)
5456
* [ 2. ESP_WiFi_MQTT](examples/ESP_WiFi_MQTT)
@@ -508,6 +510,19 @@ Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManage
508510
#define WIFI_RECON_INTERVAL 30000 // 30s
509511
```
510512
513+
#### 14. Not using Board_Name on Config_Portal
514+
515+
Default is `true`. Just change to `false` to Not using `Board_Name` on Config_Portal
516+
517+
```
518+
/////////////////////////////////////////////
519+
520+
// Optional, to use Board Name in Menu
521+
#define USING_BOARD_NAME false
522+
523+
/////////////////////////////////////////////
524+
```
525+
511526
---
512527
---
513528
@@ -791,14 +806,21 @@ Please take a look at other examples, as well.
791806
#include "Credentials.h"
792807
#include "dynamicParams.h"
793808

809+
ESP_WiFiManager_Lite* ESP_WiFiManager;
810+
794811
void heartBeatPrint()
795812
{
796813
static int num = 1;
797814

798815
if (WiFi.status() == WL_CONNECTED)
799-
Serial.print(F("H")); // H means connected to WiFi
816+
Serial.print("H"); // H means connected to WiFi
800817
else
801-
Serial.print(F("F")); // F means not connected to WiFi
818+
{
819+
if (ESP_WiFiManager->isConfigMode())
820+
Serial.print("C"); // C means in Config Mode
821+
else
822+
Serial.print("F"); // F means not connected to WiFi
823+
}
802824

803825
if (num == 80)
804826
{
@@ -825,9 +847,6 @@ void check_status()
825847
}
826848
}
827849

828-
ESP_WiFiManager_Lite* ESP_WiFiManager;
829-
830-
831850
#if USING_CUSTOMS_STYLE
832851
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
833852
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
@@ -853,6 +872,12 @@ void setup()
853872

854873
ESP_WiFiManager = new ESP_WiFiManager_Lite();
855874

875+
String AP_SSID = "your_customized_ssid";
876+
String AP_PWD = "your_customized_pwd";
877+
878+
// Set customized AP SSID and PWD
879+
ESP_WiFiManager->setConfigPortal(AP_SSID, AP_PWD);
880+
856881
// Optional to change default AP IP(192.168.4.1) and channel(10)
857882
//ESP_WiFiManager->setConfigPortalIP(IPAddress(192, 168, 120, 1));
858883
ESP_WiFiManager->setConfigPortalChannel(0);
@@ -1041,6 +1066,11 @@ void loop()
10411066

10421067
/////////////////////////////////////////////
10431068

1069+
// Optional, to use Board Name in Menu
1070+
#define USING_BOARD_NAME true
1071+
1072+
/////////////////////////////////////////////
1073+
10441074
#include <ESP_WiFiManager_Lite.h>
10451075

10461076
#if ESP8266
@@ -1233,7 +1263,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp
12331263

12341264
```
12351265
Starting ESP_WiFi using LittleFS on ESP32_DEV
1236-
ESP_WiFiManager_Lite v1.8.1
1266+
ESP_WiFiManager_Lite v1.8.2
12371267
ESP_MultiResetDetector v1.3.0
12381268
LittleFS Flag read = 0xFFFC0003
12391269
multiResetDetectorFlag = 0xFFFC0003
@@ -1289,22 +1319,22 @@ Saving config file OK
12891319
stConf:SSID=ESP_9ABF498,PW=MyESP_9ABF498
12901320
[WML] IP=192.168.4.1,ch=10
12911321
[WML] s:millis() = 1014, configTimeout = 121014
1292-
F
1322+
C
12931323
Your stored Credentials :
12941324
Blynk Server1 = new.duckdns.org
12951325
Token1 = token1
12961326
Blynk Server2 = new.ddns.net
12971327
Token2 = token2
12981328
Port = 8080
12991329
MQTT Server = mqtt.duckdns.org
1300-
FFFFFFFFF
1330+
CCCCCCCCC
13011331
```
13021332

13031333
#### 1.2. Got valid Credentials from Config Portal then connected to WiFi
13041334

13051335
```
13061336
Starting ESP_WiFi using LittleFS on ESP32_DEV
1307-
ESP_WiFiManager_Lite v1.8.1
1337+
ESP_WiFiManager_Lite v1.8.2
13081338
ESP_MultiResetDetector v1.3.0
13091339
LittleFS Flag read = 0xFFFE0001
13101340
multiResetDetectorFlag = 0xFFFE0001
@@ -1376,7 +1406,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M
13761406

13771407
```
13781408
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
1379-
ESP_WiFiManager_Lite v1.8.1
1409+
ESP_WiFiManager_Lite v1.8.2
13801410
ESP_MultiResetDetector v1.3.0
13811411
LittleFS Flag read = 0xFFFE0001
13821412
multiResetDetectorFlag = 0xFFFE0001
@@ -1419,7 +1449,7 @@ Saving config file OK
14191449
[WML] OK
14201450
[WML] SaveBkUpCPFile
14211451
[WML] OK
1422-
N
1452+
C
14231453
Your stored Credentials :
14241454
AIO_SERVER = blank
14251455
AIO_SERVERPORT = blank
@@ -1430,7 +1460,7 @@ AIO_SUB_TOPIC = blank
14301460
NStop multiResetDetecting
14311461
Saving config file...
14321462
Saving config file OK
1433-
NNN
1463+
CCC
14341464
```
14351465

14361466
#### 2.2. Got valid Credentials from Config Portal then connected to WiFi
@@ -1451,7 +1481,7 @@ NNN
14511481
14521482
14531483
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
1454-
ESP_WiFiManager_Lite v1.8.1
1484+
ESP_WiFiManager_Lite v1.8.2
14551485
ESP_MultiResetDetector v1.3.0
14561486
LittleFS Flag read = 0xFFFE0001
14571487
multiResetDetectorFlag = 0xFFFE0001
@@ -1543,7 +1573,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M
15431573

15441574
```
15451575
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1546-
ESP_WiFiManager_Lite v1.8.1
1576+
ESP_WiFiManager_Lite v1.8.2
15471577
ESP_MultiResetDetector v1.3.0
15481578
LittleFS Flag read = 0xFFFE0001
15491579
multiResetDetectorFlag = 0xFFFE0001
@@ -1567,7 +1597,7 @@ Saving config file OK
15671597
stConf:SSID=ESP_8A1DF7C,PW=MyESP_8A1DF7C
15681598
[WML] IP=192.168.4.1,ch=1
15691599
[WML] s:configTimeout = 0
1570-
N
1600+
C
15711601
Your stored Credentials :
15721602
AIO_SERVER = io.adafruit.com
15731603
AIO_SERVERPORT = 1883
@@ -1578,7 +1608,7 @@ AIO_SUB_TOPIC = /feeds/LED_Control
15781608
NStop multiResetDetecting
15791609
Saving config file...
15801610
Saving config file OK
1581-
NNN N
1611+
CCC C
15821612
```
15831613

15841614
#### 3.2. Got valid Credentials from Config Portal then connected to WiFi
@@ -1656,7 +1686,7 @@ entry 0x4004c190
16561686
16571687
16581688
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1659-
ESP_WiFiManager_Lite v1.8.1
1689+
ESP_WiFiManager_Lite v1.8.2
16601690
ESP_MultiResetDetector v1.3.0
16611691
LittleFS Flag read = 0xFFFE0001
16621692
multiResetDetectorFlag = 0xFFFE0001
@@ -1758,7 +1788,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M
17581788

17591789
```
17601790
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1761-
ESP_WiFiManager_Lite v1.8.1
1791+
ESP_WiFiManager_Lite v1.8.2
17621792
ESP_MultiResetDetector v1.3.0
17631793
LittleFS Flag read = 0xFFFC0003
17641794
multiResetDetectorFlag = 0xFFFC0003
@@ -1769,7 +1799,7 @@ Saving config file OK
17691799
[WML]
17701800
stConf:SSID=ESP_8A1DF7C,PW=MyESP_8A1DF7C
17711801
[WML] IP=192.168.4.1,ch=3
1772-
N
1802+
C
17731803
Your stored Credentials :
17741804
AIO_SERVER = io.adafruit.com
17751805
AIO_SERVERPORT = 1883
@@ -1786,7 +1816,7 @@ NNNN NNNNN NNNNN NNNNN NN[WML] h:UpdLittleFS
17861816

17871817
```
17881818
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1789-
ESP_WiFiManager_Lite v1.8.1
1819+
ESP_WiFiManager_Lite v1.8.2
17901820
ESP_MultiResetDetector v1.3.0
17911821
LittleFS Flag read = 0xFFFE0001
17921822
multiResetDetectorFlag = 0xFFFE0001
@@ -1842,7 +1872,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp
18421872

18431873
```
18441874
Starting ESP_WiFi_MQTT using LittleFS on ESP32_DEV
1845-
ESP_WiFiManager_Lite v1.8.1
1875+
ESP_WiFiManager_Lite v1.8.2
18461876
ESP_MultiResetDetector v1.3.0
18471877
LittleFS Flag read = 0xFFFC0003
18481878
multiResetDetectorFlag = 0xFFFC0003
@@ -1871,22 +1901,22 @@ Saving config file OK
18711901
[WML]
18721902
stConf:SSID=ESP_9ABF498,PW=MyESP_9ABF498
18731903
[WML] IP=192.168.4.1,ch=11
1874-
N
1904+
C
18751905
Your stored Credentials :
18761906
AIO_SERVER = io.adafruit.com
18771907
AIO_SERVERPORT = 1883
18781908
AIO_USERNAME = private
18791909
AIO_KEY = private
18801910
AIO_PUB_TOPIC = /feeds/Temperature
18811911
AIO_SUB_TOPIC = /feeds/LED_Control
1882-
N
1912+
CCC
18831913
```
18841914

18851915
### 5.2 Config Data Saved => Connection to Adafruit MQTT
18861916

18871917
```
18881918
Starting ESP_WiFi_MQTT using LittleFS on ESP32_DEV
1889-
ESP_WiFiManager_Lite v1.8.1
1919+
ESP_WiFiManager_Lite v1.8.2
18901920
ESP_MultiResetDetector v1.3.0
18911921
LittleFS Flag read = 0xFFFE0001
18921922
multiResetDetectorFlag = 0xFFFE0001
@@ -1934,7 +1964,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp
19341964

19351965
```
19361966
Starting ESP_WiFi using LittleFS on ESP32S3_DEV
1937-
ESP_WiFiManager_Lite v1.8.1
1967+
ESP_WiFiManager_Lite v1.8.2
19381968
ESP_MultiResetDetector v1.3.0
19391969
LittleFS Flag read = 0xFFFE0001
19401970
multiResetDetectorFlag = 0xFFFE0001
@@ -1976,7 +2006,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp
19762006

19772007
```
19782008
Starting ESP_WiFi using LittleFS on ESP32C3_DEV
1979-
ESP_WiFiManager_Lite v1.8.1
2009+
ESP_WiFiManager_Lite v1.8.2
19802010
ESP_MultiResetDetector v1.3.0
19812011
LittleFS Flag read = 0xFFFE0001
19822012
multiResetDetectorFlag = 0xFFFE0001
@@ -2086,6 +2116,9 @@ Submit issues to: [ESP_WiFiManager_Lite issues](https://github.com/khoih-prog/ES
20862116
28. Add support to **ESP32-S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.) using EEPROM, SPIFFS or LittleFS**
20872117
29. Add `LittleFS` support to **ESP32-C3**
20882118
30. Use `ESP32-core's LittleFS` library instead of `Lorol's LITTLEFS` library for ESP32 core v2.0.0+
2119+
31. Optimize code by passing by `reference` instead of `value`
2120+
32. Optional `Board_Name` in Config Portal
2121+
33. Add function `isConfigMode()` to signal system is in Config Portal mode
20892122

20902123
---
20912124
---

changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Release v1.8.2](#release-v182)
1516
* [Release v1.8.1](#release-v181)
1617
* [Release v1.8.0](#release-v180)
1718
* [Release v1.7.0](#release-v170)
@@ -29,6 +30,12 @@
2930

3031
## Changelog
3132

33+
### Release v1.8.2
34+
35+
1. Optimize code by using passing by `reference` instead of by `value`
36+
2. Optional `Board_Name` in Menu. Check [option to remove board name from web page #25](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/25)
37+
3. Add function `isConfigMode()` to signal system is in Config Portal mode.
38+
3239
### Release v1.8.1
3340

3441
1. Add LittleFS support to `ESP32-C3`.

examples/ESP_WiFi/ESP_WiFi.ino

+9-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@
1414
#include "Credentials.h"
1515
#include "dynamicParams.h"
1616

17+
ESP_WiFiManager_Lite* ESP_WiFiManager;
18+
1719
void heartBeatPrint()
1820
{
1921
static int num = 1;
2022

2123
if (WiFi.status() == WL_CONNECTED)
22-
Serial.print(F("H")); // H means connected to WiFi
24+
Serial.print("H"); // H means connected to WiFi
2325
else
24-
Serial.print(F("F")); // F means not connected to WiFi
26+
{
27+
if (ESP_WiFiManager->isConfigMode())
28+
Serial.print("C"); // C means in Config Mode
29+
else
30+
Serial.print("F"); // F means not connected to WiFi
31+
}
2532

2633
if (num == 80)
2734
{
@@ -48,9 +55,6 @@ void check_status()
4855
}
4956
}
5057

51-
ESP_WiFiManager_Lite* ESP_WiFiManager;
52-
53-
5458
#if USING_CUSTOMS_STYLE
5559
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
5660
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";

examples/ESP_WiFi/defines.h

+5
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@
124124

125125
/////////////////////////////////////////////
126126

127+
// Optional, to use Board Name in Menu
128+
#define USING_BOARD_NAME true
129+
130+
/////////////////////////////////////////////
131+
127132
#include <ESP_WiFiManager_Lite.h>
128133

129134
#if ESP8266

examples/ESP_WiFi_MQTT/ESP_WiFi_MQTT.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ void heartBeatPrint()
5252
static int num = 1;
5353

5454
if (WiFi.status() == WL_CONNECTED)
55-
Serial.print("W"); // W means connected to WiFi
55+
Serial.print("H"); // H means connected to WiFi
5656
else
57-
Serial.print("N"); // N means not connected to WiFi
57+
{
58+
if (ESP_WiFiManager->isConfigMode())
59+
Serial.print("C"); // C means in Config Mode
60+
else
61+
Serial.print("F"); // F means not connected to WiFi
62+
}
5863

5964
if (num == 40)
6065
{

0 commit comments

Comments
 (0)