From 363eecd556a50615d5b1d02faa53c0f1a56f47f1 Mon Sep 17 00:00:00 2001
From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com>
Date: Thu, 20 May 2021 02:01:12 -0400
Subject: [PATCH] v1.6.0 to use ESP8266 core v3.0.0
### Major Releases v1.6.0
1. Fix AP connect issue caused by **breaking ESP8266 core v3.0.0**. Caused by multiple core changes, but the new solution results a better and faster connection to AP.
2. Fix SSL issue caused by breaking ESP8266 core v3.0.0. Now the better **BearSSL** is used in both ESP32 and ESP8266 to replace the ESP8266 deprecated `axTLS`. Check [Remove axTLS from code and documentation #7437](https://github.com/esp8266/Arduino/pull/7437)
3. Fix the `BLYNK_INFO_DEVICE`displaying the generic ESP8266 board with Blynk logo. Caused by new ESP8266 core changes of `build.board`. For example from `ESP8266_NODEMCU` in core v2.7.4 to `ESP8266_NODEMCU_ESP12E` in core v3.0.0
4. Fix many warnings only displayed in new core ESP8266 v3.0.0
5. Make code compatible for either new ESP8266 core v3.0.0+ or ealier cores v2.7.4-
---
CONTRIBUTING.md | 9 +-
README.md | 151 +++++++++++++++++---
library.json | 4 +-
library.properties | 6 +-
src/BlynkSimpleEsp32_Async_WM.h | 39 +++++-
src/BlynkSimpleEsp32_SSL_Async_WM.h | 38 ++++-
src/BlynkSimpleEsp8266_Async_WM.h | 94 ++++++++++++-
src/BlynkSimpleEsp8266_SSL_Async_WM.h | 195 +++++++++++++++++++-------
8 files changed, 441 insertions(+), 95 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ef7eca0..b8e8c5d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -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.13) or Platform.io version
-* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v2.7.4 or ESP32 v1.0.6)
+* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v3.0.0 or ESP32 v1.0.6)
* 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:
@@ -26,10 +26,10 @@ Please ensure to specify the following:
### Example
```
-Arduino IDE version: 1.8.13
-ESP8266 Core Version 2.7.4
+Arduino IDE version: v1.8.13
+ESP8266 Core Version v3.0.0
OS: Ubuntu 20.04 LTS
-Linux Inspiron 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
+Linux Inspiron 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Context:
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
@@ -40,6 +40,7 @@ Steps to reproduce:
3. ...
4. ...
```
+
### Sending Feature Requests
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
diff --git a/README.md b/README.md
index fbf60e7..0e624d3 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@
* [Why using SSL insecured mode now](#why-using-ssl-insecured-mode-now)
* [Currently supported Boards](#currently-supported-boards)
* [Changelog](#changelog)
+ * [Major Releases v1.6.0](#major-releases-v160)
* [Major Releases v1.5.0](#major-releases-v150)
* [Releases v1.4.1](#releases-v141)
* [Major Releases v1.4.0](#major-releases-v140)
@@ -131,6 +132,7 @@
* [7. Async_ESP32WM_MRD_ForcedConfig using LITTLEFS with SSL on ESP32_DEV to demo WiFi Scan](#7-async_esp32wm_mrd_forcedconfig-using-littlefs-with-ssl-on-esp32_dev-to-demo-wifi-scan)
* [7.1 MRD/DRD => Open Config Portal](#71-mrddrd--open-config-portal)
* [7.2 Config Data Saved => Connection to Blynk](#72-config-data-saved--connection-to-blynk)
+ * [8. Async_ESP8266WM_MRD_Config using LITTLEFS with SSL on ESP8266_NODEMCU_ESP12E using new ESP8266 core v3.0.0](#8-async_esp8266wm_mrd_config-using-littlefs-with-ssl-on-esp8266_nodemcu_esp12e-using-new-esp8266-core-v300)
* [Debug](#debug)
* [Troubleshooting](#troubleshooting)
* [Releases](#releases)
@@ -156,6 +158,9 @@ This library is designed to help you to eliminate `hardcoding` your Wifi and Bly
Thanks to this [**Blynk_Async_WM library**](https://github.com/khoih-prog/Blynk_Async_WM) is based on and sync'ed with [`Blynk_WM library`](https://github.com/khoih-prog/Blynk_WM), all the features currently supported by [`Blynk_WM library`](https://github.com/khoih-prog/Blynk_WM) will be available. Please have a look at [`DONE`](https://github.com/khoih-prog/Blynk_Async_WM#done) or [`DONE in Blynk_WM library`](https://github.com/khoih-prog/Blynk_WM#done) for those too-many-to-list features.
+With version `v1.6.0` or later, you can use:
+
+1. `New ESP8266 core v3.0.0`
#### Why using Async
@@ -198,6 +203,14 @@ This [**Blynk_Async_WM** library](https://github.com/khoih-prog/Blynk_Async_WM)
## Changelog
+### Major Releases v1.6.0
+
+1. Fix AP connect issue caused by **breaking ESP8266 core v3.0.0**. Caused by multiple core changes, but the new solution results a better and faster connection to AP.
+2. Fix SSL issue caused by breaking ESP8266 core v3.0.0. Now the better **BearSSL** is used in both ESP32 and ESP8266 to replace the ESP8266 deprecated `axTLS`. Check [Remove axTLS from code and documentation #7437](https://github.com/esp8266/Arduino/pull/7437)
+3. Fix the `BLYNK_INFO_DEVICE`displaying the generic ESP8266 board with Blynk logo. Caused by new ESP8266 core changes of `build.board`. For example from `ESP8266_NODEMCU` in core v2.7.4 to `ESP8266_NODEMCU_ESP12E` in core v3.0.0
+4. Fix many warnings only displayed in new core ESP8266 v3.0.0
+5. Make code compatible for either new ESP8266 core v3.0.0+ or ealier cores v2.7.4-
+
### Major Releases v1.5.0
1. Enable scan of WiFi networks for selection in Configuration Portal. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](https://github.com/khoih-prog/WiFiManager_NINA_Lite/pull/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-15)
@@ -266,10 +279,10 @@ This [**Blynk_Async_WM** library](https://github.com/khoih-prog/Blynk_Async_WM)
## Prerequisites
1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
- 2. [`Blynk library 0.6.1+`](https://github.com/blynkkk/blynk-library/releases). [](https://github.com/blynkkk/blynk-library/releases/latest/)
+ 2. [`Blynk library 0.6.1+`](https://github.com/blynkkk/blynk-library/releases). [](https://github.com/blynkkk/blynk-library/releases/latest/). Never use the `Blynk beta` versions.
3. [`ESP32 Core 1.0.6+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [](https://github.com/espressif/arduino-esp32/releases/latest/)
4. [`ESP32-S2/C3 Core 1.0.6+`](https://github.com/espressif/arduino-esp32) for ESP32-S2/C3-based boards. Must follow [HOWTO Install esp32 core for ESP32-S2 (Saola, AI-Thinker ESP-12K) and ESP32-C3 boards into Arduino IDE](#howto-install-esp32-core-for-esp32-s2-saola-ai-thinker-esp-12k-and-esp32-c3-boards-into-arduino-ide).
- 5. [`ESP8266 Core 2.7.4+`](https://github.com/esp8266/Arduino) for ESP8266-based boards. [](https://github.com/esp8266/Arduino/releases/latest/). To use ESP8266 core 2.7.1+ for LittleFS.
+ 5. [`ESP8266 Core 3.0.0+`](https://github.com/esp8266/Arduino) for ESP8266-based boards. [](https://github.com/esp8266/Arduino/releases/latest/). To use ESP8266 core 2.7.1+ for LittleFS.
6. [`ESP_DoubleResetDetector library 1.1.1+`](https://github.com/khoih-prog/ESP_DoubleResetDetector) to use DRD feature. To install, check [](https://www.ardu-badge.com/ESP_DoubleResetDetector).
7. [`ESP_MultiResetDetector library 1.1.1+`](https://github.com/khoih-prog/ESP_MultiResetDetector) to use MRD feature. To install, check [](https://www.ardu-badge.com/ESP_MultiResetDetector).
8. [`LittleFS_esp32 v1.0.6+`](https://github.com/lorol/LITTLEFS) for ESP32-based boards using LittleFS. To install, check [](https://www.ardu-badge.com/LittleFS_esp32). **Notice**: This [`LittleFS_esp32 library`](https://github.com/lorol/LITTLEFS) has been integrated to Arduino [esp32 core v1.0.6](https://github.com/espressif/arduino-esp32/tree/master/libraries/LITTLEFS).
@@ -1658,7 +1671,8 @@ The following is the sample terminal output when running example [Async_ESP8266W
```
Starting Async_ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU
-Blynk_Async_WM SSL for ESP8266 v1.4.0
+ESP8266 core v2.7.4
+Blynk_Async_WM SSL for ESP8266 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -1738,7 +1752,8 @@ BBBBBB
```
Starting Async_ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU
-Blynk_Async_WM SSL for ESP8266 v1.4.0
+ESP8266 core v2.7.4
+Blynk_Async_WM SSL for ESP8266 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
@@ -1849,7 +1864,8 @@ F[229521] id: = HueNet1
```
Starting Async_ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU
-Blynk_Async_WM SSL for ESP8266 v1.4.0
+ESP8266 core v2.7.4
+Blynk_Async_WM SSL for ESP8266 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -1935,7 +1951,7 @@ The following is the sample terminal output when running example [Async_ESP32WM_
```
Starting Async_ESP32WM_MRD_Config using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2014,7 +2030,7 @@ Pubs Topics = default-mqtt-PubTopic
```
Starting Async_ESP32WM_MRD_Config using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFC0003
multiResetDetectorFlag = 0xFFFC0003
@@ -2119,7 +2135,7 @@ RFRFRF[188660] id: = HueNet1
```
Starting Async_ESP32WM_MRD_Config using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2468,7 +2484,7 @@ Blynk.resetAndEnterConfigPortal();
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2559,7 +2575,7 @@ Non-Persistent CP will be removed after first reset, even you didn't enter the C
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2674,7 +2690,7 @@ RF[66298] id: = HueNet1
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2773,7 +2789,7 @@ Blynk.resetAndEnterConfigPortalPersistent();
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2864,7 +2880,7 @@ Persistent CP will remain after resets. The only way to get rid of Config Portal
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -2976,7 +2992,7 @@ Enter CP, input (even fake data or none) and `Save` config data to exit persiste
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
LittleFS Flag read = 0xFFFE0001
multiResetDetectorFlag = 0xFFFE0001
@@ -3062,7 +3078,7 @@ The following is the sample terminal output when running example [Async_ESP32WM_
```
Starting Async_ESP32WM_ForcedConfig using LittleFS with SSL on ESP32S2_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_DoubleResetDetector v1.1.1
[958] Set CustomsStyle to :
[980] Set CustomsHeadElement to :
@@ -3142,7 +3158,7 @@ The following is the sample terminal output when running example [Async_ESP32WM_
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
[228] Set CustomsStyle to :
[250] Set CustomsHeadElement to :
@@ -3226,7 +3242,7 @@ Pubs Topics = default-mqtt-PubTopic
```
Starting Async_ESP32WM_MRD_ForcedConfig using LittleFS with SSL on ESP32_DEV
-Blynk_Async_WM SSL for ESP32 v1.5.0
+Blynk_Async_WM SSL for ESP32 v1.6.0
ESP_MultiResetDetector v1.1.1
[229] Set CustomsStyle to :
[251] Set CustomsHeadElement to :
@@ -3288,6 +3304,97 @@ Pubs Topics = default-mqtt-PubTopic
RBRBRBRBRBRBRBRB
```
+---
+
+
+### 8. Async_ESP8266WM_MRD_Config using LITTLEFS with SSL on ESP8266_NODEMCU_ESP12E using new ESP8266 core v3.0.0
+
+The following is the sample terminal output when running example [Async_ESP8266WM_MRD_Config](examples/Async_ESP8266WM_MRD_Config) on **ESP8266_NODEMCU_ESP12E** using new **ESP8266 core v3.0.0**
+
+```
+Starting Async_ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU_ESP12E
+ESP8266 core v3.0.0
+Blynk_Async_WM SSL for ESP8266 v1.6.0
+ESP_MultiResetDetector v1.1.1
+[268] Set CustomsStyle to :
+[290] Set CustomsHeadElement to :
+[297] Set CORS Header to : Your Access-Control-Allow-Origin
+LittleFS Flag read = 0xFFFE0001
+multiResetDetectorFlag = 0xFFFE0001
+lowerBytes = 0x0001, upperBytes = 0x0001
+No multiResetDetected, number of times = 1
+LittleFS Flag read = 0xFFFE0001
+Saving config file...
+Saving config file OK
+[348] Hostname=ESP8266-Async-Config
+[370] LoadCfgFile
+[370] OK
+[371] ======= Start Stored Config Data =======
+[371] Hdr=SSL_ESP8266,BrdName= ESP8266_NODEMCU_ESP12E
+[371] SSID=HueNet1,PW=password
+[373] SSID1=HueNet2,PW1=password
+[376] Server=account.duckdns.org,Token=token
+[383] Server1=account.duckdns.org,Token1=token1
+[389] Port=9443
+[390] ======= End Config Data =======
+[394] CCSum=0x395d,RCSum=0x395d
+[400] LoadCredFile
+[400] CrR:pdata=default-mqtt-server,len=34
+[402] CrR:pdata=1883,len=6
+[405] CrR:pdata=default-mqtt-username,len=34
+[409] CrR:pdata=default-mqtt-password,len=34
+[413] CrR:pdata=default-mqtt-SubTopic,len=34
+[417] CrR:pdata=default-mqtt-PubTopic,len=34
+[421] OK
+[422] CrCCsum=0x29a6,CrRCsum=0x29a6
+[425] Valid Stored Dynamic Data
+[428] Hdr=SSL_ESP8266,BrdName= ESP8266_NODEMCU_ESP12E
+[432] SSID=HueNet1,PW=password
+[435] SSID1=HueNet2,PW1=password
+[438] Server=account.duckdns.org,Token=token
+[444] Server1=account.duckdns.org,Token1=token1
+[451] Port=9443
+[452] ======= End Config Data =======
+[455] Check if isForcedCP
+[462] LoadCPFile
+[462] OK
+[462] bg: noConfigPortal = true
+[463] Connecting MultiWifi...
+[5563] WiFi connected after time: 1
+[5563] SSID: HueNet1, RSSI = -43
+[5564] Channel: 2, IP address: 192.168.2.135
+[5564] bg: WiFi OK. Try Blynk
+[5565]
+ ___ __ __
+ / _ )/ /_ _____ / /__
+ / _ / / // / _ \/ '_/
+ /____/_/\_, /_//_/_/\_\
+ /___/ v0.6.1 on ESP8266_NODEMCU_ESP12E
+
+[6580] NTP time: Thu May 20 04:54:30 2021
+[6612] BlynkArduinoClient.connect: Connecting to account.duckdns.org:9443
+[7369] Certificate OK
+[7375] Ready (ping: 1ms).
+[7451] Connected to Blynk Server = account.duckdns.org, Token = token
+[7451] bg: WiFi+Blynk OK
+
+Blynk ESP8266 using LittleFS connected.
+Board Name : ESP8266_NODEMCU_ESP12E
+B
+Your stored Credentials :
+MQTT Server = default-mqtt-server
+Port = 1883
+MQTT UserName = default-mqtt-username
+MQTT PWD = default-mqtt-password
+Subs Topics = default-mqtt-SubTopic
+Pubs Topics = default-mqtt-PubTopic
+Stop multiResetDetecting
+Saving config file...
+Saving config file OK
+BBB
+```
+
+
---
---
@@ -3326,6 +3433,14 @@ Sometimes, the library will only work if you update the board core to the latest
## Releases
+### Major Releases v1.6.0
+
+1. Fix AP connect issue caused by **breaking ESP8266 core v3.0.0**. Caused by multiple core changes, but the new solution results a better and faster connection to AP.
+2. Fix SSL issue caused by breaking ESP8266 core v3.0.0. Now the better **BearSSL** is used in both ESP32 and ESP8266 to replace the ESP8266 deprecated `axTLS`. Check [Remove axTLS from code and documentation #7437](https://github.com/esp8266/Arduino/pull/7437)
+3. Fix the `BLYNK_INFO_DEVICE`displaying the generic ESP8266 board with Blynk logo. Caused by new ESP8266 core changes of `build.board`. For example from `ESP8266_NODEMCU` in core v2.7.4 to `ESP8266_NODEMCU_ESP12E` in core v3.0.0
+4. Fix many warnings only displayed in new core ESP8266 v3.0.0
+5. Make code compatible for either new ESP8266 core v3.0.0+ or ealier cores v2.7.4-
+
### Major Releases v1.5.0
1. Enable scan of WiFi networks for selection in Configuration Portal. Check [PR for v1.3.0 - Enable scan of WiFi networks #10](https://github.com/khoih-prog/WiFiManager_NINA_Lite/pull/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-15)
@@ -3437,6 +3552,8 @@ Submit issues to: [Blynk_Async_WM issues](https://github.com/khoih-prog/Blynk_As
30. Permit optionally inputting one set of WiFi SSID/PWD by using `REQUIRE_ONE_SET_SSID_PW == true`
31. Enforce WiFi PWD minimum length of 8 chars
32. Enable **scan of WiFi networks** for selection in Configuration Portal
+33. Drastically update code to work with either ESP8266 new breaking ESP8266 core v3.0.0 or old core ESP8266 v2.7.4-
+34. Make SSL working using `BearSSL`, not deprecated `axTLS`
---
---
diff --git a/library.json b/library.json
index ca1ff20..770b4d3 100644
--- a/library.json
+++ b/library.json
@@ -1,7 +1,7 @@
{
"name": "Blynk_Async_WM",
- "version": "1.5.0",
- "description": "Library, using AsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP32 (including ESP32-S2 and ESP32-C3), ESP8266 modules to best or available MultiWiFi APs and MultiBlynk servers at runtime. Enable adding dynamic custom parameters from sketch and input using the same Config Portal (CP). CP will be auto-adjusted to match the number of dynamic parameters. Optional default Credentials to be autoloaded into CP to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. Config. Data saved in ESP8266/ESP32 LittleFS, SPIFFS or EEPROM. Multi, Double DetectDetector or Virtual CP Switch feature permits entering CP as requested. Configurable Customs HTML Headers, including Customs Style, Customs Head Elements, CORS Header.",
+ "version": "1.6.0",
+ "description": "Library, using AsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP32 (including ESP32-S2 and ESP32-C3), ESP8266 modules to best or available MultiWiFi APs and MultiBlynk servers at runtime. Enable adding dynamic custom parameters from sketch and input using the same Config Portal (CP). CP will be auto-adjusted to match the number of dynamic parameters. Optional default Credentials to be autoloaded into CP to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. Config. Data saved in ESP8266/ESP32 LittleFS, SPIFFS or EEPROM. Multi, Double DetectDetector or Virtual CP Switch feature permits entering CP as requested. Configurable Customs HTML Headers, including Customs Style, Customs Head Elements, CORS Header. Now with scanning of WiFi networks for selection in Configuration Portal and working with new ESP8266 core v3.0.0 and ESP32 core v1.0.6",
"keywords": "control, device, communication, blynk, iot, wifi, esp8266, esp32, esp32-s2, esp32-c3, async, drd, mrd, double-reset, multi-reset, config-portal, credentials, dynamic-params, customs-header, smartphone, mobile, app, web, cloud, sensors, m2m, protocol, ble, bluetooth, Manager, DynamicParameters, dynamic, configportal, usb, serial, ethernet, data, http, portal ",
"authors":
{
diff --git a/library.properties b/library.properties
index bc2d34f..80e4760 100644
--- a/library.properties
+++ b/library.properties
@@ -1,10 +1,10 @@
name=Blynk_Async_WM
-version=1.5.0
+version=1.6.0
author=Khoi Hoang
license=MIT
maintainer=Khoi Hoang
-sentence=Simple Async WiFiManager for Blynk and ESP32 (including ESP32-S2, ESP32-C3), ESP8266 with or without SSL, configuration data saved in either LittleFS, SPIFFS or EEPROM
-paragraph=Library, using AsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP32 (including ESP32-S2, ESP32-C3), ESP8266 modules to best or available MultiWiFi APs and MultiBlynk servers at runtime. Enable adding dynamic custom parameters from sketch and input using the same Config Portal (CP). CP will be auto-adjusted to match the number of dynamic parameters. Optional default Credentials to be autoloaded into CP to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. Config. Data saved in ESP8266/ESP32 LittleFS, SPIFFS or EEPROM. Multi, Double DetectDetector or Virtual CP Switch feature permits entering CP as requested. Configurable Customs HTML Headers, including Customs Style, Customs Head Elements, CORS Header.
+sentence=Simple Async WiFiManager for Blynk and ESP32 (including ESP32-S2, ESP32-C3), ESP8266 with or without SSL, configuration data saved in either LittleFS, SPIFFS or EEPROM. Now working with new ESP8266 core v3.0.0 and ESP32 core v1.0.6
+paragraph=Library, using AsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP32 (including ESP32-S2, ESP32-C3), ESP8266 modules to best or available MultiWiFi APs and MultiBlynk servers at runtime. Enable adding dynamic custom parameters from sketch and input using the same Config Portal (CP). CP will be auto-adjusted to match the number of dynamic parameters. Optional default Credentials to be autoloaded into CP to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. Config. Data saved in ESP8266/ESP32 LittleFS, SPIFFS or EEPROM. Multi, Double DetectDetector or Virtual CP Switch feature permits entering CP as requested. Configurable Customs HTML Headers, including Customs Style, Customs Head Elements, CORS Header. Now with scanning of WiFi networks for selection in Configuration Portal.
category=Communication
url=https://github.com/khoih-prog/Blynk_Async_WM
architectures=esp8266,esp32
diff --git a/src/BlynkSimpleEsp32_Async_WM.h b/src/BlynkSimpleEsp32_Async_WM.h
index 47b847b..1e2514b 100644
--- a/src/BlynkSimpleEsp32_Async_WM.h
+++ b/src/BlynkSimpleEsp32_Async_WM.h
@@ -17,7 +17,7 @@
@date Jan 2015
@brief
- Version: 1.5.0
+ Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -33,6 +33,7 @@
Fix SSL issue with Blynk Cloud Server
1.4.1 K Hoang 24/04/2021 Fix issue of custom Blynk port (different from 8080 or 9443) not working on ESP32
1.5.0 K Hoang 25/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
+ 1.6.0 K Hoang 19/05/2021 Fix AP connect and SSL issues caused by breaking ESP8266 core v3.0.0
********************************************************************************************************************************/
#pragma once
@@ -44,7 +45,34 @@
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
#endif
-#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM for ESP32 v1.5.0"
+#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM for ESP32 v1.6.0"
+
+//////////////////////////////////////////////
+// From v1.6.0 to display correct BLYNK_INFO_DEVICE
+
+#define BLYNK_USE_128_VPINS
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#define BLYNK_BUFFERS_SIZE 4096
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#if defined(ARDUINO_BOARD)
+ #define BLYNK_INFO_DEVICE ARDUINO_BOARD
+#elif defined(BOARD_NAME)
+ #define BLYNK_INFO_DEVICE BOARD_NAME
+#elif defined(BOARD_TYPE)
+ #define BLYNK_INFO_DEVICE BOARD_TYPE
+#else
+ #define BLYNK_INFO_DEVICE "ESP32"
+#endif
+
+/////////////////////////////////////////////
#define BLYNK_SEND_ATOMIC
@@ -2696,7 +2724,6 @@ class BlynkWifi
static int channel;
// Use random channel if WiFiAPChannel == 0
- // Use random channel if WiFiAPChannel == 0
if (WiFiAPChannel == 0)
{
//channel = random(MAX_WIFI_CHANNEL) + 1;
@@ -2704,14 +2731,14 @@ class BlynkWifi
}
else
channel = WiFiAPChannel;
+
+ // KH, Must be here for ESP8266 core v3.0.0. Good for v2.7.4- and ESP32 as well
+ WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(portal_ssid.c_str(), portal_pass.c_str(), channel);
BLYNK_LOG4(BLYNK_F("\nstConf:SSID="), portal_ssid, BLYNK_F(",PW="), portal_pass);
BLYNK_LOG4(BLYNK_F("IP="), portal_apIP.toString(), ",ch=", channel);
-
- delay(100); // ref: https://github.com/espressif/arduino-esp32/issues/985#issuecomment-359157428
- WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
if (!server)
{
diff --git a/src/BlynkSimpleEsp32_SSL_Async_WM.h b/src/BlynkSimpleEsp32_SSL_Async_WM.h
index 2cf5bab..7d3d9ec 100644
--- a/src/BlynkSimpleEsp32_SSL_Async_WM.h
+++ b/src/BlynkSimpleEsp32_SSL_Async_WM.h
@@ -17,7 +17,7 @@
@date Jan 2015
@brief
- Version: 1.5.0
+ Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -33,6 +33,7 @@
Fix SSL issue with Blynk Cloud Server
1.4.1 K Hoang 24/04/2021 Fix issue of custom Blynk port (different from 8080 or 9443) not working on ESP32
1.5.0 K Hoang 25/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
+ 1.6.0 K Hoang 19/05/2021 Fix AP connect and SSL issues caused by breaking ESP8266 core v3.0.0
********************************************************************************************************************************/
#pragma once
@@ -44,7 +45,34 @@
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
#endif
-#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM SSL for ESP32 v1.5.0"
+#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM SSL for ESP32 v1.6.0"
+
+//////////////////////////////////////////////
+// From v1.6.0 to display correct BLYNK_INFO_DEVICE
+
+#define BLYNK_USE_128_VPINS
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#define BLYNK_BUFFERS_SIZE 4096
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#if defined(ARDUINO_BOARD)
+ #define BLYNK_INFO_DEVICE ARDUINO_BOARD
+#elif defined(BOARD_NAME)
+ #define BLYNK_INFO_DEVICE BOARD_NAME
+#elif defined(BOARD_TYPE)
+ #define BLYNK_INFO_DEVICE BOARD_TYPE
+#else
+ #define BLYNK_INFO_DEVICE "ESP32_SSL"
+#endif
+
+/////////////////////////////////////////////
#if defined(BLYNK_SSL_USE_LETSENCRYPT)
static const char BLYNK_DEFAULT_ROOT_CA[] =
@@ -2778,14 +2806,14 @@ class BlynkWifi
}
else
channel = WiFiAPChannel;
+
+ // KH, Must be here for ESP8266 core v3.0.0. Good for v2.7.4- and ESP32 as well
+ WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(portal_ssid.c_str(), portal_pass.c_str(), channel);
BLYNK_LOG4(BLYNK_F("\nstConf:SSID="), portal_ssid, BLYNK_F(",PW="), portal_pass);
BLYNK_LOG4(BLYNK_F("IP="), portal_apIP.toString(), ",ch=", channel);
-
- delay(100); // ref: https://github.com/espressif/arduino-esp32/issues/985#issuecomment-359157428
- WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
if (!server)
{
diff --git a/src/BlynkSimpleEsp8266_Async_WM.h b/src/BlynkSimpleEsp8266_Async_WM.h
index 019576a..6edc9a4 100644
--- a/src/BlynkSimpleEsp8266_Async_WM.h
+++ b/src/BlynkSimpleEsp8266_Async_WM.h
@@ -17,7 +17,7 @@
@date Jan 2015
@brief
- Version: 1.5.0
+ Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -33,6 +33,7 @@
Fix SSL issue with Blynk Cloud Server
1.4.1 K Hoang 24/04/2021 Fix issue of custom Blynk port (different from 8080 or 9443) not working on ESP32
1.5.0 K Hoang 25/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
+ 1.6.0 K Hoang 19/05/2021 Fix AP connect and SSL issues caused by breaking ESP8266 core v3.0.0
********************************************************************************************************************************/
#pragma once
@@ -44,10 +45,89 @@
#error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting.
#endif
-#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM for ESP8266 v1.5.0"
+#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM for ESP8266 v1.6.0"
#include
+/////////////////////////////////////////////
+
+#if (ARDUINO_ESP8266_GIT_VER == 0xefb0341a)
+ #define USING_ESP8266_CORE_VERSION 30000
+ #define ESP8266_CORE_VERSION "ESP8266 core v3.0.0"
+ #warning USING_ESP8266_CORE_VERSION "3.0.0"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x2843a5ac)
+ #define USING_ESP8266_CORE_VERSION 20704
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.4"
+ #warning USING_ESP8266_CORE_VERSION "2.7.4"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x5d3af165)
+ #define USING_ESP8266_CORE_VERSION 20703
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.3"
+ #warning USING_ESP8266_CORE_VERSION "2.7.3"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x39c79d9b)
+ #define USING_ESP8266_CORE_VERSION 20702
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.2"
+ #warning USING_ESP8266_CORE_VERSION "2.7.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0xa5432625)
+ #define USING_ESP8266_CORE_VERSION 20701
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.1"
+ #warning USING_ESP8266_CORE_VERSION "2.7.1"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x3d128e5c)
+ #define USING_ESP8266_CORE_VERSION 20603
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.3"
+ #warning USING_ESP8266_CORE_VERSION "2.6.3"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x482516e3)
+ #define USING_ESP8266_CORE_VERSION 20602
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.2"
+ #warning USING_ESP8266_CORE_VERSION "2.6.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x482516e3)
+ #define USING_ESP8266_CORE_VERSION 20601
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.1"
+ #warning USING_ESP8266_CORE_VERSION "2.6.1"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x643ec203)
+ #define USING_ESP8266_CORE_VERSION 20600
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.0"
+ #warning USING_ESP8266_CORE_VERSION "2.6.0"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x8b899c12)
+ #define USING_ESP8266_CORE_VERSION 20502
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.5.2"
+ #warning USING_ESP8266_CORE_VERSION "2.5.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x00000000)
+ #define USING_ESP8266_CORE_VERSION 20402
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.4.2"
+ #warning USING_ESP8266_CORE_VERSION "2.4.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x643ec203)
+ #define USING_ESP8266_CORE_VERSION 0
+ #define ESP8266_CORE_VERSION "ESP8266 core too old"
+ #warning USING_ESP8266_CORE_VERSION "0.0.0"
+#endif
+
+//////////////////////////////////////////////
+// From v1.6.0 to display correct BLYNK_INFO_DEVICE
+
+#define BLYNK_USE_128_VPINS
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#define BLYNK_BUFFERS_SIZE 4096
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#if defined(ARDUINO_BOARD)
+ #define BLYNK_INFO_DEVICE ARDUINO_BOARD
+#elif defined(BOARD_NAME)
+ #define BLYNK_INFO_DEVICE BOARD_NAME
+#elif defined(BOARD_TYPE)
+ #define BLYNK_INFO_DEVICE BOARD_TYPE
+#else
+ #define BLYNK_INFO_DEVICE "ESP8266"
+#endif
+
+/////////////////////////////////////////////
+
#if ESP_SDK_VERSION_NUMBER < 0x020200
#error Please update your ESP8266 Arduino Core
#endif
@@ -2664,7 +2744,6 @@ class BlynkWifi
static int channel;
// Use random channel if WiFiAPChannel == 0
- // Use random channel if WiFiAPChannel == 0
if (WiFiAPChannel == 0)
{
//channel = random(MAX_WIFI_CHANNEL) + 1;
@@ -2672,15 +2751,18 @@ class BlynkWifi
}
else
channel = WiFiAPChannel;
+
+ // KH, Must be here for ESP8266 core v3.0.0. Good for v2.7.4- and ESP32 as well
+ WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP(portal_ssid.c_str(), portal_pass.c_str(), channel);
BLYNK_LOG4(BLYNK_F("\nstConf:SSID="), portal_ssid, BLYNK_F(",PW="), portal_pass);
BLYNK_LOG4(BLYNK_F("IP="), portal_apIP.toString(), ",ch=", channel);
- delay(100); // ref: https://github.com/espressif/arduino-esp32/issues/985#issuecomment-359157428
- WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
-
+ IPAddress myIP = WiFi.softAPIP();
+ BLYNK_LOG2(BLYNK_F("AP IP address: "), myIP);
+
if (!server)
{
server = new AsyncWebServer(HTTP_PORT);
diff --git a/src/BlynkSimpleEsp8266_SSL_Async_WM.h b/src/BlynkSimpleEsp8266_SSL_Async_WM.h
index f5d8192..1cf53f7 100644
--- a/src/BlynkSimpleEsp8266_SSL_Async_WM.h
+++ b/src/BlynkSimpleEsp8266_SSL_Async_WM.h
@@ -17,7 +17,7 @@
@date Jan 2015
@brief
- Version: 1.5.0
+ Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
@@ -33,6 +33,7 @@
Fix SSL issue with Blynk Cloud Server
1.4.1 K Hoang 24/04/2021 Fix issue of custom Blynk port (different from 8080 or 9443) not working on ESP32
1.5.0 K Hoang 25/04/2021 Enable scan of WiFi networks for selection in Configuration Portal
+ 1.6.0 K Hoang 19/05/2021 Fix AP connect and SSL issues caused by breaking ESP8266 core v3.0.0
********************************************************************************************************************************/
#pragma once
@@ -44,10 +45,89 @@
#error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting.
#endif
-#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM SSL for ESP8266 v1.5.0"
+#define BLYNK_ASYNC_WM_VERSION "Blynk_Async_WM SSL for ESP8266 v1.6.0"
#include
+/////////////////////////////////////////////
+
+#if (ARDUINO_ESP8266_GIT_VER == 0xefb0341a)
+ #define USING_ESP8266_CORE_VERSION 30000
+ #define ESP8266_CORE_VERSION "ESP8266 core v3.0.0"
+ #warning USING_ESP8266_CORE_VERSION "3.0.0"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x2843a5ac)
+ #define USING_ESP8266_CORE_VERSION 20704
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.4"
+ #warning USING_ESP8266_CORE_VERSION "2.7.4"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x5d3af165)
+ #define USING_ESP8266_CORE_VERSION 20703
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.3"
+ #warning USING_ESP8266_CORE_VERSION "2.7.3"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x39c79d9b)
+ #define USING_ESP8266_CORE_VERSION 20702
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.2"
+ #warning USING_ESP8266_CORE_VERSION "2.7.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0xa5432625)
+ #define USING_ESP8266_CORE_VERSION 20701
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.7.1"
+ #warning USING_ESP8266_CORE_VERSION "2.7.1"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x3d128e5c)
+ #define USING_ESP8266_CORE_VERSION 20603
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.3"
+ #warning USING_ESP8266_CORE_VERSION "2.6.3"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x482516e3)
+ #define USING_ESP8266_CORE_VERSION 20602
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.2"
+ #warning USING_ESP8266_CORE_VERSION "2.6.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x482516e3)
+ #define USING_ESP8266_CORE_VERSION 20601
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.1"
+ #warning USING_ESP8266_CORE_VERSION "2.6.1"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x643ec203)
+ #define USING_ESP8266_CORE_VERSION 20600
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.6.0"
+ #warning USING_ESP8266_CORE_VERSION "2.6.0"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x8b899c12)
+ #define USING_ESP8266_CORE_VERSION 20502
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.5.2"
+ #warning USING_ESP8266_CORE_VERSION "2.5.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x00000000)
+ #define USING_ESP8266_CORE_VERSION 20402
+ #define ESP8266_CORE_VERSION "ESP8266 core v2.4.2"
+ #warning USING_ESP8266_CORE_VERSION "2.4.2"
+#elif (ARDUINO_ESP8266_GIT_VER == 0x643ec203)
+ #define USING_ESP8266_CORE_VERSION 0
+ #define ESP8266_CORE_VERSION "ESP8266 core too old"
+ #warning USING_ESP8266_CORE_VERSION "0.0.0"
+#endif
+
+//////////////////////////////////////////////
+// From v1.6.0 to display correct BLYNK_INFO_DEVICE
+
+#define BLYNK_USE_128_VPINS
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#define BLYNK_BUFFERS_SIZE 4096
+
+#if defined(BLYNK_INFO_DEVICE)
+ #undef BLYNK_INFO_DEVICE
+#endif
+
+#if defined(ARDUINO_BOARD)
+ #define BLYNK_INFO_DEVICE ARDUINO_BOARD
+#elif defined(BOARD_NAME)
+ #define BLYNK_INFO_DEVICE BOARD_NAME
+#elif defined(BOARD_TYPE)
+ #define BLYNK_INFO_DEVICE BOARD_TYPE
+#else
+ #define BLYNK_INFO_DEVICE "ESP8266"
+#endif
+
+/////////////////////////////////////////////
+
#if ESP_SDK_VERSION_NUMBER < 0x020200
#error Please update your ESP8266 Arduino Core
#endif
@@ -55,15 +135,25 @@
// Fingerprint is not used by default
//#define BLYNK_DEFAULT_FINGERPRINT "FD C0 7D 8D 47 97 F7 E3 07 05 D3 4E E3 BB 8E 3D C0 EA BE 1C"
//#define BLYNK_DEFAULT_FINGERPRINT "32 35 C9 6C 05 1B 73 2C 37 E8 31 0C 70 EE 67 10 1F D6 07 6A"
+// As of May 19th 2021
+#define BLYNK_DEFAULT_FINGERPRINT "98 FA DE 11 98 EB C4 19 C3 C2 8A 6A EB B8 AC EA A2 10 5E 92"
+
+#define BLYNK_SSL_USE_LETSENCRYPT false //true
#if defined(BLYNK_SSL_USE_LETSENCRYPT)
-static const unsigned char BLYNK_DEFAULT_CERT_DER[] PROGMEM =
-#include // TODO: using DST Root CA X3 for now
- //#include
- //#include
+
+ static const char BLYNK_DEFAULT_CERT_DER[] PROGMEM =
+ #include
+ #warning Using v3.0.0 BLYNK_DEFAULT_CERT_DER with BLYNK_SSL_USE_LETSENCRYPT
+
#else
-static const unsigned char BLYNK_DEFAULT_CERT_DER[] PROGMEM =
-#include
+
+ static const char BLYNK_DEFAULT_CERT_DER[] PROGMEM =
+ #include
+ //#include
+ #warning Using v3.0.0 BLYNK_DEFAULT_CERT_DER without BLYNK_SSL_USE_LETSENCRYPT
+
+ #warning Not Using BLYNK_SSL_USE_LETSENCRYPT
#endif
#include
@@ -238,26 +328,17 @@ class BlynkArduinoClientSecure
BlynkArduinoClientSecure(Client& client)
: BlynkArduinoClientGen(client)
, fingerprint(NULL)
+ , caCert(NULL)
{}
- void setFingerprint(const char* fp) {
+ void setFingerprint(const char* fp)
+ {
fingerprint = fp;
}
-
- bool setCACert(const uint8_t* caCert, unsigned caCertLen) {
- bool res = this->client->setCACert(caCert, caCertLen);
- if (!res) {
- BLYNK_LOG1("Failed to load root CA certificate!");
- }
- return res;
- }
-
- bool setCACert_P(const uint8_t* caCert, unsigned caCertLen) {
- bool res = this->client->setCACert_P(caCert, caCertLen);
- if (!res) {
- BLYNK_LOG1("Failed to load root CA certificate!");
- }
- return res;
+
+ void setRootCA(const char* fp)
+ {
+ caCert = fp;
}
bool connect()
@@ -284,35 +365,34 @@ class BlynkArduinoClientSecure
ntpTime.trim();
BLYNK_LOG2("NTP time: ", ntpTime);
- /////////////////////////////////////////
- // KH, New v1.4.0
+ // KH, From core v1.6.0, OK with core v3.0.0+ as well as v2.7.4-
+ BearSSL::X509List cert(caCert);
+ this->client->setTrustAnchors(&cert);
+
if (String(this->domain) == BLYNK_DEFAULT_DOMAIN)
- {
- this->client->setInsecure();
+ {
+ this->client->setInsecure();
}
- /////////////////////////////////////////
-
+
// Now try connecting
if (BlynkArduinoClientGen::connect())
+ {
+ BLYNK_LOG1(BLYNK_F("Certificate OK"));
+
+ return true;
+ }
+ else
{
- if (fingerprint && this->client->verify(fingerprint, this->domain))
- {
- BLYNK_LOG1(BLYNK_F("Fingerprint OK"));
- return true;
- }
- else if (this->client->verifyCertChain(this->domain))
- {
- BLYNK_LOG1(BLYNK_F("Certificate OK"));
- return true;
- }
- BLYNK_LOG1(BLYNK_F("Certificate not validated"));
- return false;
+ BLYNK_LOG1(BLYNK_F("Secure connection failed"));
}
+
return false;
}
private:
- const char* fingerprint;
+
+ const char* fingerprint;
+ const char* caCert;
};
#define MAX_ID_LEN 5
@@ -498,10 +578,14 @@ class BlynkWifi
Base::begin(auth);
this->conn.begin(domain, port);
- if (fingerprint) {
+ if (fingerprint)
+ {
this->conn.setFingerprint(fingerprint);
- } else {
- this->conn.setCACert_P(BLYNK_DEFAULT_CERT_DER, sizeof(BLYNK_DEFAULT_CERT_DER));
+ }
+ else
+ {
+ // KH, From core v1.6.0, OK with core v3.0.0+ as well as v2.7.4-
+ this->conn.setRootCA(BLYNK_DEFAULT_CERT_DER);
}
}
@@ -513,10 +597,14 @@ class BlynkWifi
Base::begin(auth);
this->conn.begin(ip, port);
- if (fingerprint) {
+ if (fingerprint)
+ {
this->conn.setFingerprint(fingerprint);
- } else {
- this->conn.setCACert_P(BLYNK_DEFAULT_CERT_DER, sizeof(BLYNK_DEFAULT_CERT_DER));
+ }
+ else
+ {
+ // KH, From core v1.6.0, OK with core v3.0.0+ as well as v2.7.4-
+ this->conn.setRootCA(BLYNK_DEFAULT_CERT_DER);
}
}
@@ -2792,13 +2880,16 @@ class BlynkWifi
else
channel = WiFiAPChannel;
+ // KH, Must be here for ESP8266 core v3.0.0. Good for v2.7.4- and ESP32 as well
+ WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
+
WiFi.softAP(portal_ssid.c_str(), portal_pass.c_str(), channel);
BLYNK_LOG4(BLYNK_F("\nstConf:SSID="), portal_ssid, BLYNK_F(",PW="), portal_pass);
BLYNK_LOG4(BLYNK_F("IP="), portal_apIP.toString(), ",ch=", channel);
-
- delay(100); // ref: https://github.com/espressif/arduino-esp32/issues/985#issuecomment-359157428
- WiFi.softAPConfig(portal_apIP, portal_apIP, IPAddress(255, 255, 255, 0));
+
+ IPAddress myIP = WiFi.softAPIP();
+ BLYNK_LOG2(BLYNK_F("AP IP address: "), myIP);
if (!server)
{