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

Commit 19d09f5

Browse files
authored
v1.0.11
### Releases 1.0.11 1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](#27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true` 2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](#26) and [Wifi.softAPConfig() sometimes set the wrong IP address](espressif/arduino-esp32#985). 3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](#25) and [WiFi.disconnect(true) problem](espressif/arduino-esp32#400). 4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list. 5. Enhance README.md with more instructions and illustrations.
1 parent fae9e87 commit 19d09f5

File tree

20 files changed

+490
-288
lines changed

20 files changed

+490
-288
lines changed

README.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88

99
---
1010

11-
### Releases 1.0.10
11+
### Releases 1.0.11
12+
13+
1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true`
14+
2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Wifi.softAPConfig() sometimes set the wrong IP address](https://github.com/espressif/arduino-esp32/issues/985).
15+
3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25) and [WiFi.disconnect(true) problem](https://github.com/espressif/arduino-esp32/issues/400).
16+
4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list.
17+
5. Enhance README.md with more instructions and illustrations.
18+
19+
20+
#### Releases 1.0.10
1221

1322
1. Don't need to reinput already working SSID in Config Port to update other parameters, such as StaticIP.
1423
2. Disable/Enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used.
@@ -45,6 +54,7 @@
4554
1. Add function getConfigPortalPW()
4655
2. Add 4 new complicated examples compatible with ArduinoJson 6.0.0+ :[AutoConnect](examples/AutoConnect), [AutoConnectWithFeedback](examples/AutoConnectWithFeedback), [AutoConnectWithFeedbackLED](examples/AutoConnectWithFeedbackLED) and [AutoConnectWithFSParameters](examples/AutoConnectWithFSParameters)
4756

57+
---
4858
---
4959

5060
This library is based on, modified, bug-fixed and improved from:
@@ -197,6 +207,10 @@ String Router_Pass;
197207
// See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21)
198208
#define USE_CLOUDFLARE_NTP false
199209

210+
// New in v1.0.11
211+
#define USING_CORS_FEATURE true
212+
//////
213+
200214
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
201215
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
202216
// Force DHCP to be true
@@ -408,6 +422,8 @@ ESP_wifiManager.setConfigPortalChannel(0);
408422
//////
409423
```
410424

425+
---
426+
411427
#### 12. Using fixed AP-mode channel, for example channel 3
412428

413429

@@ -417,14 +433,47 @@ ESP_wifiManager.setConfigPortalChannel(0);
417433
ESP_wifiManager.setConfigPortalChannel(3);
418434
//////
419435
```
436+
---
420437

421-
#### 11. Setting STA-mode static IP
438+
#### 13. Setting STA-mode static IP
422439

423440

424441
```cpp
425442
// Set static IP, Gateway, Subnetmask, DNS1 and DNS2. New in v1.0.5
426443
ESP_wifiManager.setSTAStaticIPConfig(stationIP, gatewayIP, netMask, dns1IP, dns2IP);
427444
```
445+
---
446+
447+
#### 14. Using AUTOCONNECT_NO_INVALIDATE feature
448+
449+
1. Don't invalidate WiFi SSID/PW when calling autoConnect() (default)
450+
451+
```cpp
452+
#define AUTOCONNECT_NO_INVALIDATE true
453+
```
454+
455+
2. To invalidate WiFi SSID/PW when calling autoConnect()
456+
457+
```cpp
458+
#define AUTOCONNECT_NO_INVALIDATE false
459+
```
460+
---
461+
462+
#### 15. Using CORS (Cross-Origin Resource Sharing) feature
463+
464+
1. To use CORS feature
465+
466+
```cpp
467+
// Default false for using only whenever necessary to avoid security issue
468+
#define USING_CORS_FEATURE true
469+
```
470+
471+
2. Not use CORS feature (default)
472+
473+
```cpp
474+
// Default false for using only whenever necessary to avoid security issue
475+
#define USING_CORS_FEATURE false
476+
```
428477

429478
---
430479
---
@@ -490,6 +539,7 @@ Once WiFi network information is saved in the `ESP32 / ESP8266`, it will try to
490539
13. [AutoConnectWithFSParameters](examples/AutoConnectWithFSParameters)
491540
14. [ConfigOnSwitchFS_MQTT_Ptr](examples/ConfigOnSwitchFS_MQTT_Ptr)
492541

542+
---
493543
---
494544

495545
## So, how it works?
@@ -528,6 +578,7 @@ Enter your credentials, then click ***Save***. The WiFi Credentials will be save
528578

529579
If you're already connected to a listed WiFi AP and don't want to change anything, just select ***Exit Portal*** from the `Main` page to reboot the board and connect to the previously-stored AP. The WiFi Credentials are still intact.
530580

581+
---
531582
---
532583

533584
## Documentation
@@ -635,6 +686,7 @@ void loop()
635686

636687
See [ConfigOnSwitch](examples/ConfigOnSwitch) example for a more complex version.
637688

689+
---
638690
---
639691

640692
#### Custom Parameters
@@ -927,6 +979,10 @@ String Router_Pass;
927979
// See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21)
928980
#define USE_CLOUDFLARE_NTP false
929981

982+
// New in v1.0.11
983+
#define USING_CORS_FEATURE true
984+
//////
985+
930986
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
931987
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
932988
// Force DHCP to be true
@@ -1662,6 +1718,7 @@ After waiting 0 secs more in setup(), connection result is connected. Local IP:
16621718
HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH
16631719
```
16641720

1721+
---
16651722
---
16661723

16671724
### Debug
@@ -1678,6 +1735,7 @@ You can also change the debugging level from 0 to 4
16781735
#define _WIFIMGR_LOGLEVEL_ 3
16791736
```
16801737
---
1738+
---
16811739

16821740
### Troubleshooting
16831741
If you get compilation errors, more often than not, you may need to install a newer version of the `ESP32 / ESP8266` core for Arduino.
@@ -1693,8 +1751,17 @@ If you connect to the created configuration Access Point but the ConfigPortal do
16931751
Submit issues to: [ESP_WiFiManager issues](https://github.com/khoih-prog/ESP_WiFiManager/issues)
16941752

16951753
---
1754+
---
1755+
1756+
### Releases 1.0.11
1757+
1758+
1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true`
1759+
2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Wifi.softAPConfig() sometimes set the wrong IP address](https://github.com/espressif/arduino-esp32/issues/985).
1760+
3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25) and [WiFi.disconnect(true) problem](https://github.com/espressif/arduino-esp32/issues/400).
1761+
4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list.
1762+
5. Enhance README.md with more instructions and illustrations.
16961763

1697-
### Releases 1.0.10
1764+
#### Releases 1.0.10
16981765

16991766
1. Don't need to reinput already working SSID in Config Port to update other parameters, such as StaticIP.
17001767
2. Disable/Enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used.
@@ -1764,6 +1831,7 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous
17641831
- Fix bug that keeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
17651832
- Add example ConfigPortalParamsOnSwitch to enable ConfigPortal credentials to be reconfigurable using ConfigPortal.
17661833

1834+
---
17671835
---
17681836

17691837
### Contributions and Thanks
@@ -1773,8 +1841,12 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous
17731841
3. Thanks to [CrispinP](https://github.com/CrispinP) for idea to add HostName (v1.0.4) and request to reduce the unnecessary waiting time in ESP_WiFiManager constructor (v1.0.6+). See [Starting WiFIManger is very slow (2000ms)](https://github.com/khoih-prog/ESP_WiFiManager/issues/6)
17741842
4. Thanks to [OttoKlaasen](https://github.com/OttoKlaasen) for reporting [Having issue to read the SPIFF file](https://github.com/khoih-prog/ESP_WiFiManager/issues/14) bug in examples.
17751843
5. Thanks to [Giuseppe](https://github.com/Gius-8) for reporting [Static Station IP doesn't work](https://github.com/khoih-prog/ESP_WiFiManager/issues/17) bug.
1776-
6. Thanks to [AlesSt](https://github.com/AlesSt) for reporting [On Android phone ConfigPortal is unresponsive](https://github.com/khoih-prog/ESP_WiFiManager/issues/23) and request an enhancement (***HOWTO disable the static IP inputs on the config page***) leading to [ESP_WiFiManager v1.0.10](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.10).
1844+
6. Thanks to [AlesSt](https://github.com/AlesSt) for reporting then help provide the fixes:
1845+
- [On Android phone ConfigPortal is unresponsive](https://github.com/khoih-prog/ESP_WiFiManager/issues/23) and request an enhancement (***HOWTO disable the static IP inputs on the config page***) leading to [ESP_WiFiManager v1.0.10](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.10).
1846+
- [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25), [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) leading to [ESP_WiFiManager v1.0.11](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.11).
17771847
7. Thanks to [wackoo-arduino](https://github.com/wackoo-arduino) for agreeing to contribute the sample code dealing with MQTT which the [ConfigOnSwitchFS_MQTT_Ptr](examples/ConfigOnSwitchFS_MQTT_Ptr) is based on. See [Custom MQTT parameters using Wifi Manager](https://forum.arduino.cc/index.php?topic=692108.75).
1848+
8. Thanks to [05prateek](https://github.com/05prateek) for reporting [Stationmode Static IP changes to dhcp when esp8266 is restarted](https://github.com/khoih-prog/ESP_WiFiManager/issues/28) bug which is fixed in v1.0.11 by enhance autoConnect() function.
1849+
17781850

17791851

17801852
<table>
@@ -1787,8 +1859,9 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous
17871859
<td align="center"><a href="https://github.com/Giuseppe"><img src="https://github.com/Giuseppe.png" width="100px;" alt="Giuseppe"/><br /><sub><b>Giuseppe</b></sub></a><br /></td>
17881860
</tr>
17891861
<tr>
1790-
<td align="center"><a href="https://github.com/AlesSt"><img src="https://github.com/AlesSt.png" width="100px;" alt="AlesSt"/><br /><sub><b>AlesSt</b></sub></a><br /></td>
1862+
<td align="center"><a href="https://github.com/AlesSt"><img src="https://github.com/AlesSt.png" width="100px;" alt="AlesSt"/><br /><sub><b>⭐️ AlesSt</b></sub></a><br /></td>
17911863
<td align="center"><a href="https://github.com/wackoo-arduino"><img src="https://github.com/wackoo-arduino.png" width="100px;" alt="wackoo-arduino"/><br /><sub><b>wackoo-arduino</b></sub></a><br /></td>
1864+
<td align="center"><a href="https://github.com/05prateek"><img src="https://github.com/05prateek.png" width="100px;" alt="05prateek"/><br /><sub><b>05prateek</b></sub></a><br /></td>
17921865
</tr>
17931866
</table>
17941867

examples/AutoConnect/AutoConnect.ino

Lines changed: 61 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
1111
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
1212
Licensed under MIT license
13-
Version: 1.0.10
14-
15-
Version Modified By Date Comments
16-
------- ----------- ---------- -----------
17-
1.0.0 K Hoang 07/10/2019 Initial coding
18-
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
19-
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
20-
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
21-
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
22-
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
23-
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
24-
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
25-
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
26-
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
27-
Add, enhance examples (fix MDNS for ESP32)
28-
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
13+
Version: 1.0.11
14+
15+
Version Modified By Date Comments
16+
------- ----------- ---------- -----------
17+
1.0.0 K Hoang 07/10/2019 Initial coding
18+
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
19+
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
20+
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
21+
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
22+
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
23+
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
24+
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
25+
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
26+
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
27+
Add, enhance examples (fix MDNS for ESP32)
28+
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
29+
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
2930
*****************************************************************************************************************************/
3031
#if !( defined(ESP8266) || defined(ESP32) )
3132
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
@@ -36,24 +37,24 @@
3637

3738
//Ported to ESP32
3839
#ifdef ESP32
39-
#include <esp_wifi.h>
40-
#include <WiFi.h>
41-
#include <WiFiClient.h>
42-
43-
#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())
44-
45-
#define LED_ON HIGH
46-
#define LED_OFF LOW
40+
#include <esp_wifi.h>
41+
#include <WiFi.h>
42+
#include <WiFiClient.h>
43+
44+
#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())
45+
46+
#define LED_ON HIGH
47+
#define LED_OFF LOW
4748
#else
48-
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
49-
//needed for library
50-
#include <DNSServer.h>
51-
#include <ESP8266WebServer.h>
52-
53-
#define ESP_getChipId() (ESP.getChipId())
54-
55-
#define LED_ON LOW
56-
#define LED_OFF HIGH
49+
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
50+
//needed for library
51+
#include <DNSServer.h>
52+
#include <ESP8266WebServer.h>
53+
54+
#define ESP_getChipId() (ESP.getChipId())
55+
56+
#define LED_ON LOW
57+
#define LED_OFF HIGH
5758
#endif
5859

5960
// SSID and PW for your Router
@@ -78,36 +79,41 @@ String Router_Pass;
7879
// See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21)
7980
#define USE_CLOUDFLARE_NTP false
8081

82+
// New in v1.0.11
83+
#define USING_CORS_FEATURE true
84+
//////
85+
8186
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
8287
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
83-
// Force DHCP to be true
84-
#if defined(USE_DHCP_IP)
85-
#undef USE_DHCP_IP
86-
#endif
87-
#define USE_DHCP_IP true
88+
// Force DHCP to be true
89+
#if defined(USE_DHCP_IP)
90+
#undef USE_DHCP_IP
91+
#endif
92+
#define USE_DHCP_IP true
8893
#else
89-
// You can select DHCP or Static IP here
90-
//#define USE_DHCP_IP true
91-
#define USE_DHCP_IP false
94+
// You can select DHCP or Static IP here
95+
//#define USE_DHCP_IP true
96+
#define USE_DHCP_IP false
9297
#endif
9398

9499
#if ( USE_DHCP_IP || ( defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP ) )
95100
// Use DHCP
96-
#warning Using DHCP IP
97-
IPAddress stationIP = IPAddress(0, 0, 0, 0);
98-
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
99-
IPAddress netMask = IPAddress(255, 255, 255, 0);
101+
#warning Using DHCP IP
102+
IPAddress stationIP = IPAddress(0, 0, 0, 0);
103+
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
104+
IPAddress netMask = IPAddress(255, 255, 255, 0);
100105
#else
101-
// Use static IP
102-
#warning Using static IP
103-
#ifdef ESP32
104-
IPAddress stationIP = IPAddress(192, 168, 2, 232);
105-
#else
106-
IPAddress stationIP = IPAddress(192, 168, 2, 186);
107-
#endif
108-
109-
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
110-
IPAddress netMask = IPAddress(255, 255, 255, 0);
106+
// Use static IP
107+
#warning Using static IP
108+
109+
#ifdef ESP32
110+
IPAddress stationIP = IPAddress(192, 168, 2, 232);
111+
#else
112+
IPAddress stationIP = IPAddress(192, 168, 2, 186);
113+
#endif
114+
115+
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
116+
IPAddress netMask = IPAddress(255, 255, 255, 0);
111117
#endif
112118

113119
#define USE_CONFIGURABLE_DNS true

0 commit comments

Comments
 (0)