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

Commit f799090

Browse files
authored
v1.2.0
### Release v1.2.0 1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header. 2. Fix Config Portal Bug. 3. Update examples
1 parent 169ebca commit f799090

File tree

12 files changed

+458
-67
lines changed

12 files changed

+458
-67
lines changed

README.md

Lines changed: 120 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Features](#features)
1616
* [Currently supported Boards](#currently-supported-boards)
1717
* [Changelog](#changelog)
18+
* [Release v1.2.0](#release-v120)
1819
* [Release v1.1.0](#release-v110)
1920
* [Release v1.0.0](#release-v100)
2021
* [Prerequisites](#prerequisites)
@@ -43,6 +44,16 @@
4344
* [3. ESP32 WiFi uses ADC2 for WiFi functions](#3-esp32-wifi-uses-adc2-for-wifi-functions)
4445
* [How It Works](#how-it-works)
4546
* [How to use](#how-to-use)
47+
* [1. Basic usage](#1-basic-usage)
48+
* [2. Add custom parameters](#2-add-custom-parameters)
49+
* [3. Not using custom parameters](#3-not-using-custom-parameters)
50+
* [4. To open Config Portal](#4-to-open-config-portal)
51+
* [5. To use different AP WiFi Channel](#5-to-use-different-ap-wifi-channel)
52+
* [6. To use different static AP IP from default](#6-to-use-different-static-ap-ip-from-default)
53+
* [7. To use custom DHCP HostName](#7-to-use-custom-dhcp-hostname)
54+
* [8. To use custom HTML Style](#8-to-use-custom-html-style)
55+
* [9. To use custom Head Elements](#9-to-use-custom-head-elements)
56+
* [10. To use CORS Header](#10-to-use-cors-header)
4657
* [Examples](#examples)
4758
* [ 1. ESP_WiFi](examples/ESP_WiFi)
4859
* [ 2. ESP_WiFi_MQTT](examples/ESP_WiFi_MQTT)
@@ -122,14 +133,20 @@ New recent features:
122133

123134
This [**ESP_WiFiManager_Lite** library](https://github.com/khoih-prog/ESP_WiFiManager_Lite) currently supports these following boards:
124135

125-
1. **ESP32**
136+
1. **ESP32 including ESP32-S2 (ESP32-S2 Saola, AI-Thinker ESP-12K, etc.)**
126137
2. **ESP8266**
127138

128139
---
129140
---
130141

131142
## Changelog
132143

144+
### Release v1.2.0
145+
146+
1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header.
147+
2. Fix Config Portal Bug.
148+
3. Update examples
149+
133150
### Release v1.1.0
134151

135152
1. Add support to **ESP32-S2 (ESP32-S2 Saola and AI-Thinker ESP-12K)**
@@ -146,11 +163,11 @@ This [**ESP_WiFiManager_Lite** library](https://github.com/khoih-prog/ESP_WiFiMa
146163

147164
1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
148165
2. [`ESP8266 Core 2.7.4+`](https://github.com/esp8266/Arduino) for ESP8266-based boards. [![Latest release](https://img.shields.io/github/release/esp8266/Arduino.svg)](https://github.com/esp8266/Arduino/releases/latest/)
149-
3. [`ESP32 Core 1.0.4+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [Latest stable release ![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)
166+
3. [`ESP32 Core 1.0.4+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
150167
4. [`ESP32S2 Core 1.0.4+`](https://github.com/espressif/arduino-esp32/tree/esp32s2) for ESP32S2-based boards.
151168
5. [`ESP_DoubleResetDetector v1.1.1+`](https://github.com/khoih-prog/ESP_DoubleResetDetector) if using DRD feature. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_DoubleResetDetector.svg?)](https://www.ardu-badge.com/ESP_DoubleResetDetector).
152169
6. [`ESP_MultiResetDetector v1.1.1+`](https://github.com/khoih-prog/ESP_MultiResetDetector) if using MRD feature. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_MultiResetDetector.svg?)](https://www.ardu-badge.com/ESP_MultiResetDetector).
153-
7. [`LittleFS_esp32 v1.0.5+`](https://github.com/lorol/LITTLEFS) for ESP32-based (including ESP32-S2) boards using LittleFS.
170+
7. [`LittleFS_esp32 v1.0.5+`](https://github.com/lorol/LITTLEFS) for ESP32-based boards using LittleFS. To install, check [![arduino-library-badge](https://www.ardu-badge.com/badge/LittleFS_esp32.svg?)](https://www.ardu-badge.com/LittleFS_esp32).
154171

155172
---
156173

@@ -364,10 +381,13 @@ Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master
364381
- In the operation, if the current WiFi connection is lost because of any reason, the system will **auto(Re)connect** to the remaining WiFi AP.
365382
- **If system can't connect to any of the 2 WiFi APs, the Config Portal will start**, after some pre-determined time, to permit user to update the Credentials.
366383

384+
---
367385
---
368386

369387
### How to use
370388

389+
#### 1. Basic usage
390+
371391
- Include in your sketch
372392

373393
```cpp
@@ -377,6 +397,8 @@ Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master
377397
ESP_WiFiManager_Lite* ESP_WiFiManager;
378398
```
379399

400+
#### 2. Add custom parameters
401+
380402
- To add custom parameters, just add
381403

382404
```
@@ -386,7 +408,7 @@ ESP_WiFiManager_Lite* ESP_WiFiManager;
386408
387409
/////////////// Start dynamic Credentials ///////////////
388410
389-
//Defined in <WiFiManager_Generic_Lite.h>
411+
//Defined in <ESP_WiFiManager_Lite.h>
390412
/**************************************
391413
#define MAX_ID_LEN 5
392414
#define MAX_DISPLAY_NAME_LEN 16
@@ -439,46 +461,87 @@ uint16_t NUM_MENU_ITEMS = 0;
439461
440462
```
441463

464+
#### 3. Not using custom parameters
465+
442466
- If you don't need to add dynamic parameters, use the following in sketch
443467

444468
```
445469
#define USE_DYNAMIC_PARAMETERS false
446470
```
447471

472+
#### 4. To open Config Portal
473+
448474
- When you want to open a config portal, just add
449475

450476
```cpp
451477
ESP_WiFiManager = new ESP_WiFiManager_Lite();
452478
ESP_WiFiManager->begin();
453479
```
454480

455-
- To not use default AP WiFi Channel 10 to avoid conflict with other WiFi APs, call
481+
#### 5. To use different AP WiFi Channel
482+
483+
- To not use default AP WiFi Channel 10 to avoid conflict with other WiFi APs :
456484

457485
```cpp
458486
ESP_WiFiManager->setConfigPortalChannel(newChannel);
459487
```
460488
489+
- To use random AP WiFi Channel to avoid conflict with other WiFi APs :
490+
491+
```cpp
492+
ESP_WiFiManager->setConfigPortalChannel(0);
493+
```
494+
495+
#### 6. To use different static AP IP from default
496+
461497
- To use different static AP IP (not use default `192.168.4.1`), call
462498

463499
```cpp
464500
ESP_WiFiManager->setConfigPortalIP(IPAddress(xxx,xxx,xxx,xxx));
465501
```
466502
467-
- To set custom DHCP HostName, cal
503+
#### 7. To use custom DHCP HostName
504+
505+
- To set custom DHCP HostName :
468506
469507
```
470-
// Set customized DHCP HostName
471-
ESP_WiFiManager->begin("SAMD_ABCDEF");
508+
// Set customized DHCP HostName
509+
ESP_WiFiManager->begin("ESP32-WIFI_ABCDEF");
472510
```
473511
474-
or just use the default Hostname, for example "SAMD_XXXXXX" for SAMD
512+
or just use the default Hostname, for example "ESP_ABCDEF"
475513
476514
```
477-
//Or use default Hostname "WIFI_GENERIC_XXXXXX"
478-
//ESP_WiFiManager->begin();
515+
//Or use default Hostname "ESPC_ABCDEF"
516+
ESP_WiFiManager->begin();
517+
```
518+
519+
#### 8. To use custom HTML Style
520+
521+
```
522+
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
523+
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
524+
525+
...
526+
527+
ESP_WiFiManager->setCustomsStyle(NewCustomsStyle);
479528
```
480529
481-
While in AP mode, connect to it using its `SSID` (WIFI_GENERIC_XXXXXX) / `Password` ("MyWIFI_GENERIC_XXXXXX"), then open a browser to the Portal AP IP, default `192.168.4.1`, configure wifi then click **Save**. The Credentials / WiFi connection information will be saved in non-volatile memory. It will then autoconnect.
530+
#### 9. To use custom Head Elements
531+
532+
533+
```
534+
ESP_WiFiManager->setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
535+
```
536+
537+
#### 10. To use CORS Header
538+
539+
```
540+
ESP_WiFiManager->setCORSHeader("Your Access-Control-Allow-Origin");
541+
```
542+
543+
544+
While in AP mode, connect to it using its `SSID` (ESP_ABCDEF) / `Password` ("MyESP_ABCDEF"), then open a browser to the Portal AP IP, default `192.168.4.1`, configure wifi then click **Save**. The Credentials / WiFi connection information will be saved in non-volatile memory. It will then autoconnect.
482545
483546
484547
Once Credentials / WiFi network information is saved in the host non-volatile memory, it will try to autoconnect to WiFi every time it is started, without requiring any function calls in the sketch.
@@ -496,7 +559,7 @@ Once Credentials / WiFi network information is saved in the host non-volatile me
496559
497560
## So, how it works?
498561
499-
In `Configuration Portal Mode`, it starts an AP called `ESP_WXXXXXX`. Connect to it using the `configurable password` you can define in the code. For example, `MyESP_WXXXXXX` (see examples):
562+
In `Configuration Portal Mode`, it starts an AP called `ESP_ABCDEF`. Connect to it using the `configurable password` you can define in the code. For example, `MyESP_ABCDEF` (see examples):
500563
501564
After you connected, please, go to http://192.168.4.1 or newly configured AP IP, you'll see this `Main` page:
502565
@@ -650,7 +713,7 @@ Example of [Default dynamicParams](examples/ESP_WiFi/dynamicParams.h)
650713
651714
/////////////// Start dynamic Credentials ///////////////
652715
653-
//Defined in <WiFiManager_Generic_Lite.h>
716+
//Defined in <ESP_WiFiManager_Lite.h>
654717
/**************************************
655718
#define MAX_ID_LEN 5
656719
#define MAX_DISPLAY_NAME_LEN 16
@@ -784,6 +847,12 @@ void check_status()
784847

785848
ESP_WiFiManager_Lite* ESP_WiFiManager;
786849

850+
851+
#if USING_CUSTOMS_STYLE
852+
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
853+
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
854+
#endif
855+
787856
void setup()
788857
{
789858
// Debug console
@@ -806,11 +875,23 @@ void setup()
806875

807876
// Optional to change default AP IP(192.168.4.1) and channel(10)
808877
//ESP_WiFiManager->setConfigPortalIP(IPAddress(192, 168, 120, 1));
809-
//ESP_WiFiManager->setConfigPortalChannel(1);
878+
ESP_WiFiManager->setConfigPortalChannel(0);
879+
880+
#if USING_CUSTOMS_STYLE
881+
ESP_WiFiManager->setCustomsStyle(NewCustomsStyle);
882+
#endif
883+
884+
#if USING_CUSTOMS_HEAD_ELEMENT
885+
ESP_WiFiManager->setCustomsHeadElement("<style>html{filter: invert(10%);}</style>");
886+
#endif
887+
888+
#if USING_CORS_FEATURE
889+
ESP_WiFiManager->setCORSHeader("Your Access-Control-Allow-Origin");
890+
#endif
810891

811892
// Set customized DHCP HostName
812893
ESP_WiFiManager->begin(HOST_NAME);
813-
//Or use default Hostname "NRF52-WIFI-XXXXXX"
894+
//Or use default Hostname "ESP32-WIFI-XXXXXX"
814895
//ESP_WiFiManager->begin();
815896
}
816897

@@ -876,7 +957,7 @@ void loop()
876957
/* Comment this out to disable prints and save space */
877958
#define ESP_WM_LITE_DEBUG_OUTPUT Serial
878959

879-
#define _ESP_WM_LITE_LOGLEVEL_ 3
960+
#define _ESP_WM_LITE_LOGLEVEL_ 2
880961

881962
#define USING_MRD true
882963

@@ -910,6 +991,13 @@ void loop()
910991

911992
/////////////////////////////////////////////
912993

994+
// Add customs headers from v1.2.0
995+
#define USING_CUSTOMS_STYLE true
996+
#define USING_CUSTOMS_HEAD_ELEMENT true
997+
#define USING_CORS_FEATURE true
998+
999+
/////////////////////////////////////////////
1000+
9131001
// Force some params
9141002
#define TIMEOUT_RECONNECT_WIFI 10000L
9151003
#define RESET_IF_CONFIG_TIMEOUT true
@@ -1044,7 +1132,7 @@ ESP_WM_LITE_Configuration defaultConfig;
10441132

10451133
/////////////// Start dynamic Credentials ///////////////
10461134

1047-
//Defined in <WiFiManager_Generic_Lite.h>
1135+
//Defined in <ESP_WiFiManager_Lite.h>
10481136
/**************************************
10491137
#define MAX_ID_LEN 5
10501138
#define MAX_DISPLAY_NAME_LEN 16
@@ -1112,7 +1200,7 @@ This is the terminal output when running [**ESP_WiFi**](examples/ESP_WiFi) examp
11121200

11131201
```
11141202
Starting ESP_WiFi using LittleFS on ESP32_DEV
1115-
ESP_WiFiManager_Lite v1.1.0
1203+
ESP_WiFiManager_Lite v1.2.0
11161204
ESP_MultiResetDetector v1.1.1
11171205
LittleFS Flag read = 0xFFFC0003
11181206
multiResetDetectorFlag = 0xFFFC0003
@@ -1183,7 +1271,7 @@ FFFFFFFFF
11831271

11841272
```
11851273
Starting ESP_WiFi using LittleFS on ESP32_DEV
1186-
ESP_WiFiManager_Lite v1.1.0
1274+
ESP_WiFiManager_Lite v1.2.0
11871275
ESP_MultiResetDetector v1.1.1
11881276
LittleFS Flag read = 0xFFFE0001
11891277
multiResetDetectorFlag = 0xFFFE0001
@@ -1255,7 +1343,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M
12551343

12561344
```
12571345
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
1258-
ESP_WiFiManager_Lite v1.1.0
1346+
ESP_WiFiManager_Lite v1.2.0
12591347
ESP_MultiResetDetector v1.1.1
12601348
LittleFS Flag read = 0xFFFE0001
12611349
multiResetDetectorFlag = 0xFFFE0001
@@ -1330,7 +1418,7 @@ NNN
13301418
13311419
13321420
Starting ESP_WiFi_MQTT using LittleFS on ESP8266_NODEMCU
1333-
ESP_WiFiManager_Lite v1.1.0
1421+
ESP_WiFiManager_Lite v1.2.0
13341422
ESP_MultiResetDetector v1.1.1
13351423
LittleFS Flag read = 0xFFFE0001
13361424
multiResetDetectorFlag = 0xFFFE0001
@@ -1423,7 +1511,7 @@ This is the terminal output when running [**ESP_WiFi_MQTT**](examples/ESP_WiFi_M
14231511

14241512
```
14251513
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1426-
ESP_WiFiManager_Lite v1.1.0
1514+
ESP_WiFiManager_Lite v1.2.0
14271515
ESP_MultiResetDetector v1.1.1
14281516
LittleFS Flag read = 0xFFFE0001
14291517
multiResetDetectorFlag = 0xFFFE0001
@@ -1536,7 +1624,7 @@ entry 0x4004c190
15361624
15371625
15381626
Starting ESP_WiFi_MQTT using LittleFS on ESP32S2_DEV
1539-
ESP_WiFiManager_Lite v1.1.0
1627+
ESP_WiFiManager_Lite v1.2.0
15401628
ESP_MultiResetDetector v1.1.1
15411629
LittleFS Flag read = 0xFFFE0001
15421630
multiResetDetectorFlag = 0xFFFE0001
@@ -1661,6 +1749,12 @@ If you get compilation errors, more often than not, you may need to install a ne
16611749

16621750
## Releases
16631751

1752+
### Release v1.2.0
1753+
1754+
1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header.
1755+
2. Fix Config Portal Bug.
1756+
3. Update examples
1757+
16641758
### Release v1.1.0
16651759

16661760
1. Add support to **ESP32-S2 (ESP32-S2 Saola and AI-Thinker ESP-12K)**
@@ -1696,7 +1790,7 @@ Submit issues to: [ESP_WiFiManager_Lite issues](https://github.com/khoih-prog/ES
16961790
6. Change Synch XMLHttpRequest to Async
16971791
7. Add configurable Static IP, GW, Subnet Mask and 2 DNS Servers' IP Addresses.
16981792
8. Add checksums
1699-
9. Add support to **ESP32 and ESP8266**
1793+
9. Add support to **ESP32 including ESP32-S2 (ESP32-S2 Saola, AI-Thinker ESP-12K, etc.) and ESP8266**
17001794
10. Add MultiWiFi features with auto(re)connect
17011795
11. Easy-to-use **Dynamic Parameters** without the necessity to write complicated ArduinoJSon functions
17021796
12. Permit to input special chars such as **%** and **#** into data fields.
@@ -1705,7 +1799,7 @@ Submit issues to: [ESP_WiFiManager_Lite issues](https://github.com/khoih-prog/ES
17051799
15. Configurable Config Portal Title
17061800
16. Re-structure all examples to separate Credentials / Defines / Dynamic Params / Code so that you can change Credentials / Dynamic Params quickly for each device.
17071801
17. Add Table of Contents and Version String
1708-
1802+
18. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header
17091803

17101804
---
17111805
---

0 commit comments

Comments
 (0)