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

Commit

Permalink
v1.8.2 to optimize code, etc.
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
khoih-prog authored Feb 21, 2022
1 parent 98490f4 commit ce798e2
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 66 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.19) or Platform.io version
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v3.0.2 or ESP32 v2.0.2)
* Board Core Version (e.g. ESP8266 core v3.0.2, ESP32 core v2.0.2)
* 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 @@ -27,9 +27,10 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.19
ESP8266 Core Version 3.0.2
ESP32_DEV board
ESP32 core v2.0.2
OS: Ubuntu 20.04 LTS
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
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
Context:
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
Expand Down
87 changes: 60 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP_WiFiManager_Lite.svg)](http://github.com/khoih-prog/ESP_WiFiManager_Lite/issues)

<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>
<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>
<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>

---
---
Expand Down Expand Up @@ -49,6 +50,7 @@
* [13. To avoid blocking in loop when WiFi is lost](#13-To-avoid-blocking-in-loop-when-wifi-is-lost)
* [13.1 Max times to try WiFi per loop](#131-max-times-to-try-wifi-per-loop)
* [13.2 Interval between reconnection WiFi if lost](#132-interval-between-reconnection-wifi-if-lost)
* [14. Not using Board_Name on Config_Portal](#14-Not-using-Board_Name-on-Config_Portal)
* [Examples](#examples)
* [ 1. ESP_WiFi](examples/ESP_WiFi)
* [ 2. ESP_WiFi_MQTT](examples/ESP_WiFi_MQTT)
Expand Down Expand Up @@ -508,6 +510,19 @@ Check [retries block the main loop #18](https://github.com/khoih-prog/WiFiManage
#define WIFI_RECON_INTERVAL 30000 // 30s
```
#### 14. Not using Board_Name on Config_Portal
Default is `true`. Just change to `false` to Not using `Board_Name` on Config_Portal
```
/////////////////////////////////////////////

// Optional, to use Board Name in Menu
#define USING_BOARD_NAME false

/////////////////////////////////////////////
```
---
---
Expand Down Expand Up @@ -791,14 +806,21 @@ Please take a look at other examples, as well.
#include "Credentials.h"
#include "dynamicParams.h"

ESP_WiFiManager_Lite* ESP_WiFiManager;

void heartBeatPrint()
{
static int num = 1;

if (WiFi.status() == WL_CONNECTED)
Serial.print(F("H")); // H means connected to WiFi
Serial.print("H"); // H means connected to WiFi
else
Serial.print(F("F")); // F means not connected to WiFi
{
if (ESP_WiFiManager->isConfigMode())
Serial.print("C"); // C means in Config Mode
else
Serial.print("F"); // F means not connected to WiFi
}

if (num == 80)
{
Expand All @@ -825,9 +847,6 @@ void check_status()
}
}

ESP_WiFiManager_Lite* ESP_WiFiManager;


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

ESP_WiFiManager = new ESP_WiFiManager_Lite();

String AP_SSID = "your_customized_ssid";
String AP_PWD = "your_customized_pwd";

// Set customized AP SSID and PWD
ESP_WiFiManager->setConfigPortal(AP_SSID, AP_PWD);

// Optional to change default AP IP(192.168.4.1) and channel(10)
//ESP_WiFiManager->setConfigPortalIP(IPAddress(192, 168, 120, 1));
ESP_WiFiManager->setConfigPortalChannel(0);
Expand Down Expand Up @@ -1041,6 +1066,11 @@ void loop()

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

// Optional, to use Board Name in Menu
#define USING_BOARD_NAME true

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

#include <ESP_WiFiManager_Lite.h>

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

```
Starting ESP_WiFi using LittleFS on ESP32_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
Expand Down Expand Up @@ -1289,22 +1319,22 @@ Saving config file OK
stConf:SSID=ESP_9ABF498,PW=MyESP_9ABF498
[WML] IP=192.168.4.1,ch=10
[WML] s:millis() = 1014, configTimeout = 121014
F
C
Your stored Credentials :
Blynk Server1 = new.duckdns.org
Token1 = token1
Blynk Server2 = new.ddns.net
Token2 = token2
Port = 8080
MQTT Server = mqtt.duckdns.org
FFFFFFFFF
CCCCCCCCC
```

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

```
Starting ESP_WiFi using LittleFS on ESP32_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1376,7 +1406,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M

```
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1419,7 +1449,7 @@ Saving config file OK
[WML] OK
[WML] SaveBkUpCPFile
[WML] OK
N
C
Your stored Credentials :
AIO_SERVER = blank
AIO_SERVERPORT = blank
Expand All @@ -1430,7 +1460,7 @@ AIO_SUB_TOPIC = blank
NStop multiResetDetecting
Saving config file...
Saving config file OK
NNN
CCC
```

#### 2.2. Got valid Credentials from Config Portal then connected to WiFi
Expand All @@ -1451,7 +1481,7 @@ NNN
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1543,7 +1573,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M

```
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand All @@ -1567,7 +1597,7 @@ Saving config file OK
stConf:SSID=ESP_8A1DF7C,PW=MyESP_8A1DF7C
[WML] IP=192.168.4.1,ch=1
[WML] s:configTimeout = 0
N
C
Your stored Credentials :
AIO_SERVER = io.adafruit.com
AIO_SERVERPORT = 1883
Expand All @@ -1578,7 +1608,7 @@ AIO_SUB_TOPIC = /feeds/LED_Control
NStop multiResetDetecting
Saving config file...
Saving config file OK
NNN N
CCC C
```

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

```
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
Expand All @@ -1769,7 +1799,7 @@ Saving config file OK
[WML]
stConf:SSID=ESP_8A1DF7C,PW=MyESP_8A1DF7C
[WML] IP=192.168.4.1,ch=3
N
C
Your stored Credentials :
AIO_SERVER = io.adafruit.com
AIO_SERVERPORT = 1883
Expand All @@ -1786,7 +1816,7 @@ NNNN NNNNN NNNNN NNNNN NN[WML] h:UpdLittleFS

```
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1842,7 +1872,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp

```
Starting ESP_WiFi_MQTT using LittleFS on ESP32_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
Expand Down Expand Up @@ -1871,22 +1901,22 @@ Saving config file OK
[WML]
stConf:SSID=ESP_9ABF498,PW=MyESP_9ABF498
[WML] IP=192.168.4.1,ch=11
N
C
Your stored Credentials :
AIO_SERVER = io.adafruit.com
AIO_SERVERPORT = 1883
AIO_USERNAME = private
AIO_KEY = private
AIO_PUB_TOPIC = /feeds/Temperature
AIO_SUB_TOPIC = /feeds/LED_Control
N
CCC
```

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

```
Starting ESP_WiFi_MQTT using LittleFS on ESP32_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1934,7 +1964,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp

```
Starting ESP_WiFi using LittleFS on ESP32S3_DEV
ESP_WiFiManager_Lite v1.8.1
ESP_WiFiManager_Lite v1.8.2
ESP_MultiResetDetector v1.3.0
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
Expand Down Expand Up @@ -1976,7 +2006,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp

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

---
---
Expand Down
7 changes: 7 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.8.2](#release-v182)
* [Release v1.8.1](#release-v181)
* [Release v1.8.0](#release-v180)
* [Release v1.7.0](#release-v170)
Expand All @@ -29,6 +30,12 @@

## Changelog

### 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](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/25)
3. Add function `isConfigMode()` to signal system is in Config Portal mode.

### Release v1.8.1

1. Add LittleFS support to `ESP32-C3`.
Expand Down
14 changes: 9 additions & 5 deletions examples/ESP_WiFi/ESP_WiFi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@
#include "Credentials.h"
#include "dynamicParams.h"

ESP_WiFiManager_Lite* ESP_WiFiManager;

void heartBeatPrint()
{
static int num = 1;

if (WiFi.status() == WL_CONNECTED)
Serial.print(F("H")); // H means connected to WiFi
Serial.print("H"); // H means connected to WiFi
else
Serial.print(F("F")); // F means not connected to WiFi
{
if (ESP_WiFiManager->isConfigMode())
Serial.print("C"); // C means in Config Mode
else
Serial.print("F"); // F means not connected to WiFi
}

if (num == 80)
{
Expand All @@ -48,9 +55,6 @@ void check_status()
}
}

ESP_WiFiManager_Lite* ESP_WiFiManager;


#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
Expand Down
5 changes: 5 additions & 0 deletions examples/ESP_WiFi/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@

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

// Optional, to use Board Name in Menu
#define USING_BOARD_NAME true

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

#include <ESP_WiFiManager_Lite.h>

#if ESP8266
Expand Down
9 changes: 7 additions & 2 deletions examples/ESP_WiFi_MQTT/ESP_WiFi_MQTT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ void heartBeatPrint()
static int num = 1;

if (WiFi.status() == WL_CONNECTED)
Serial.print("W"); // W means connected to WiFi
Serial.print("H"); // H means connected to WiFi
else
Serial.print("N"); // N means not connected to WiFi
{
if (ESP_WiFiManager->isConfigMode())
Serial.print("C"); // C means in Config Mode
else
Serial.print("F"); // F means not connected to WiFi
}

if (num == 40)
{
Expand Down
Loading

0 comments on commit ce798e2

Please sign in to comment.