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

Commit

Permalink
v1.6.0 to use ESP8266 core v3.0.0
Browse files Browse the repository at this point in the history
### 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](esp8266/Arduino#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-
  • Loading branch information
khoih-prog authored May 20, 2021
1 parent 089b453 commit 363eecd
Show file tree
Hide file tree
Showing 8 changed files with 441 additions and 95 deletions.
9 changes: 5 additions & 4 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.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:
Expand All @@ -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.
Expand All @@ -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.
Expand Down
151 changes: 134 additions & 17 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -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":
{
Expand Down
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=Blynk_Async_WM
version=1.5.0
version=1.6.0
author=Khoi Hoang
license=MIT
maintainer=Khoi Hoang <[email protected]>
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
Expand Down
39 changes: 33 additions & 6 deletions src/BlynkSimpleEsp32_Async_WM.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@date Jan 2015
@brief
Version: 1.5.0
Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -2696,22 +2724,21 @@ 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;
channel = (millis() % MAX_WIFI_CHANNEL) + 1;
}
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)
{
Expand Down
38 changes: 33 additions & 5 deletions src/BlynkSimpleEsp32_SSL_Async_WM.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@date Jan 2015
@brief
Version: 1.5.0
Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -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
Expand All @@ -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[] =
Expand Down Expand Up @@ -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)
{
Expand Down
94 changes: 88 additions & 6 deletions src/BlynkSimpleEsp8266_Async_WM.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@date Jan 2015
@brief
Version: 1.5.0
Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -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
Expand All @@ -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 <version.h>

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

#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
Expand Down Expand Up @@ -2664,23 +2744,25 @@ 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;
channel = (millis() % MAX_WIFI_CHANNEL) + 1;
}
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);
Expand Down
Loading

0 comments on commit 363eecd

Please sign in to comment.