diff --git a/README.md b/README.md index f9f28dc..fa2ddb4 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ * [Features](#features) * [Currently supported Boards](#currently-supported-boards) * [Changelog](#changelog) + * [Major Releases v1.3.0](#major-releases-v130) * [Major Releases v1.2.0](#major-releases-v120) * [Releases v1.1.3](#releases-v113) * [Releases v1.1.2](#releases-v112) @@ -34,21 +35,23 @@ * [Installation](#installation) * [I) For Arduino IDE](#i-for-arduino-ide) * [II) For VS Code & PlatformIO:](#ii-for-vs-code--platformio) -* [HOWTO Install esp32-s2 core for ESP32-S2 (Saola, AI-Thinker ESP-12K) boards into Arduino IDE)](#howto-install-esp32-s2-core-for-esp32-s2-saola-ai-thinker-esp-12k-boards-into-arduino-ide) +* [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) * [1. Save the original esp32 core](#1-save-the-original-esp32-core) - * [2. Download esp32-s2 core](#2-download-esp32-s2-core) - * [2.1 Download zip](#21-download-zip) - * [2.2 Unzip](#22-unzip) - * [2.3 Update esp32-s2 core directories](#23-update-esp32-s2-core-directories) - * [3. Download tools](#3-download-tools) + * [2. Install esp32 core v1.0.6](#2-install-esp32-core-v106) + * [2.1 Install esp32 core](#21-install-esp32-core) + * [2.2 Download latest zip with esp32-s2 support](#22-download-latest-zip-with-esp32-s2-support) + * [2.3 Unzip](#23-unzip) + * [2.3 Update esp32 core directories](#24-update-esp32-core-directories) + * [3. Download tools for ESP32-S2](#3-download-tools-for-esp32-s2) * [3.1 Download Toolchain for Xtensa (ESP32-S2) based on GCC](#31-download-toolchain-for-xtensa-esp32-s2-based-on-gcc) * [3.2 Download esptool](#32-download-esptool) * [3.3 Unzip](#33-unzip) * [4. Update tools](#4-update-tools) * [4.1 Update Toolchain](#41-update-toolchain) * [4.2 Update esptool](#42-update-esptool) - * [5. esp32-s2 WebServer Library Patch](#5-esp32-s2-webserver-library-patch) -* [Note for Platform IO using ESP32 LittleFS](#note-for-platform-io-using-esp32-littlefs) + * [5. Download tools for ESP32-C3](#5-download-tools-for-esp32-c3) + * [6. esp32-s2 WebServer Library Patch](#6-esp32-s2-webserver-library-patch) +* [Note for Platform IO using ESP32 LittleFS](#note-for-platform-io-using-esp32-littlefs) * [HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)](#howto-use-analogread-with-esp32-running-wifi-andor-bluetooth-btble) * [1. ESP32 has 2 ADCs, named ADC1 and ADC2](#1--esp32-has-2-adcs-named-adc1-and-adc2) * [2. ESP32 ADCs functions](#2-esp32-adcs-functions) @@ -106,6 +109,8 @@ * [6. ESP8266WM_MRD_ForcedConfig using persistent ConfigPortal virtual button](#6-esp8266wm_mrd_forcedconfig-using-persistent-configportal-virtual-button) * [6.1. Start normally then press persistent ConfigPortal virtual button](#61-start-normally-then-press-persistent-configportal-virtual-button) * [6.2. Enter persistent ConfigPortal](#62-enter-persistent-configportal) + * [7. ESP8266WM_MRD_ForcedConfig using LITTLEFS with SSL on ESP8266_NODEMCU](#7-esp8266wm_mrd_forcedconfig-using-littlefs-with-ssl-on-esp8266_nodemcu) + * [8. ESP32WM_MRD_Config using LITTLEFS with SSL on ESP32S2_DEV](#8-esp32wm_mrd_config-using-littlefs-with-ssl-on-esp32s2_dev) * [Debug](#debug) * [Troubleshooting](#troubleshooting) * [Releases](#releases) @@ -183,6 +188,13 @@ This [**BlynkESP32_BT_WF** library](https://github.com/khoih-prog/BlynkESP32_BT_ ## Changelog +### Major Releases v1.3.0 + +1. Add **LittleFS and SPIFFS** support to new **ESP32-S2** boards (**Arduino ESP32C3_DEV**). Check [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). +2. Add **EEPROM and SPIFFS** support to new **ESP32-C3** boards (**Arduino ESP32C3_DEV**). Check [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). +3. Fix SSL issue with Blynk Cloud Server +4. Update examples + ### Major Releases v1.2.0 1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header. @@ -264,12 +276,12 @@ Thanks to [Thor Johnson](https://github.com/thorathome) to test, suggest and enc 1. [`Arduino IDE 1.8.13+`](https://www.arduino.cc/en/Main/Software) 2. [`Blynk library 0.6.1+`](https://github.com/blynkkk/blynk-library/releases). [![Latest release](https://img.shields.io/github/release/blynkkk/blynk-library.svg)](https://github.com/blynkkk/blynk-library/releases/latest/) -3. [`ESP32 Core 1.0.5+`](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/) -4. [`ESP32S2 Core 1.0.5+`](https://github.com/espressif/arduino-esp32/tree/esp32s2) for ESP32S2-based boards. +3. [`ESP32 Core 1.0.6+`](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/) +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. [![Latest release](https://img.shields.io/github/release/esp8266/Arduino.svg)](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 [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_DoubleResetDetector.svg?)](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 [![arduino-library-badge](https://www.ardu-badge.com/badge/ESP_MultiResetDetector.svg?)](https://www.ardu-badge.com/ESP_MultiResetDetector). -8. [`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). +8. [`LittleFS_esp32 v1.0.6+`](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). --- @@ -318,7 +330,7 @@ Thanks to [Thor Johnson](https://github.com/thorathome) to test, suggest and enc --- --- -## HOWTO Install esp32-s2 core for ESP32-S2 (Saola, AI-Thinker ESP-12K) boards into Arduino IDE +## HOWTO Install esp32 core for ESP32-S2 (Saola, AI-Thinker ESP-12K) and ESP32-C3 boards into Arduino IDE These are instructions demonstrating the steps to install esp32-s2 core on Ubuntu machines. For Windows or other OS'es, just follow the the similar principles and steps. @@ -336,27 +348,32 @@ First, copy the whole original esp32 core to another safe place. Then delete all --- -### 2. Download esp32-s2 core -#### 2.1 Download zip +### 2. Install esp32 core v1.0.6 + +#### 2.1 Install esp32 core + +Just use Arduino IDE Board Manager to install [ESP32 Arduino Release 1.0.6 based on ESP-IDF v3.3.5](https://github.com/espressif/arduino-esp32/releases/tag/1.0.6). This official v1.06 core doesn't have esp32-s2/s3 support. You have to download and use the latest master branch. -Download [**esp32-s2 core**](https://github.com/espressif/arduino-esp32/tree/esp32s2) in the `zip` format: -`arduino-esp32-esp32s2.zip` +#### 2.2 Download latest zip with esp32-s2 support -#### 2.2 Unzip +As of **April 16th 2021**, the **esp32-s2/c3** board support has been included in master branch of esp32 core. Download [**esp32 core, master branch**](https://github.com/espressif/arduino-esp32) in the zip format. + +#### 2.3 Unzip

-#### 2.3 Update esp32-s2 core directories +#### 2.4 Update esp32 core directories + +Copy all subdirectories of esp32 core into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.6` -Copy all subdirectories of esp32-s2 core into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.4` --- -### 3 Download tools +### 3 Download tools for ESP32-S2 #### 3.1 Download Toolchain for Xtensa (ESP32-S2) based on GCC @@ -389,7 +406,7 @@ Download [esptool](https://github.com/espressif/esptool/releases) int the `zip` #### 4.1 Update Toolchain -Copy whole `xtensa-esp32s2-elf` directory into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools` +Copy whole `xtensa-esp32s2-elf` directory into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools` #### 4.2 Update esptool @@ -397,7 +414,7 @@ Copy whole `xtensa-esp32s2-elf` directory into `/home/your_account/.arduino15/pa Rename `esptool-3.0` directory to `esptool` -Copy whole `esptool` directory into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools` +Copy whole `esptool` directory into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools`

@@ -405,7 +422,32 @@ Copy whole `esptool` directory into `/home/your_account/.arduino15/packages/esp3

-### 5. esp32-s2 WebServer Library Patch +### 5 Download tools for ESP32-C3 + +Download [**esp32-c3 Toolchain**](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/tools/idf-tools.html#riscv32-esp-elf) corresponding to your environment (linux-amd64, win64, etc.). + +For example`riscv32-esp-elf-gcc8_4_0-crosstool-ng-1.24.0-123-g64eb9ff-linux-amd64.tar.gz`, then un-archive. + +Then using the similar steps as in + +* [3. Download tools for ESP32-S2](#3-download-tools-for-esp32-s2) + * [3.1 Download Toolchain for Xtensa (ESP32-S2) based on GCC](#31-download-toolchain-for-xtensa-esp32-s2-based-on-gcc) + * [3.2 Download esptool](#32-download-esptool) + * [3.3 Unzip](#33-unzip) +* [4. Update tools](#4-update-tools) + * [4.1 Update Toolchain](#41-update-toolchain) + * [4.2 Update esptool](#42-update-esptool) + +then copy whole `riscv32-esp-elf` directory into `/home/your_account/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools` + +

+ +

+ + +### 6. esp32-s2 WebServer Library Patch + +#### Necessary only for esp32 core v1.0.6- If you haven't installed a new version with [WebServer.handleClient delay PR #4350](https://github.com/espressif/arduino-esp32/pull/4350) or haven't applied the above mentioned PR, you have to use the following patch. @@ -420,13 +462,17 @@ Supposing the esp32-s2 version is 1.0.4, these files `WebServer.h/cpp` must be c --- -That's it. You're now ready to compile and test for ESP32-S2 now +That's it. You're now ready to compile and test for **ESP32-S2 and ESP32-C3** now --- --- ### Note for Platform IO using ESP32 LittleFS +#### Necessary only for esp32 core v1.0.6- + +From esp32 core v1.0.6+, [`LittleFS_esp32 v1.0.6`](https://github.com/lorol/LITTLEFS) has been included and this step is not necessary anymore. + In Platform IO, to fix the error when using [`LittleFS_esp32 v1.0`](https://github.com/lorol/LITTLEFS) for ESP32-based boards with ESP32 core v1.0.4- (ESP-IDF v3.2-), uncomment the following line from @@ -932,7 +978,7 @@ Then click **Save**. The system will auto-restart. You will see the board's buil #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; @@ -1184,13 +1230,34 @@ void loop() #### 2. File [defines.h](examples/ESP32WM_MRD_ForcedConfig/defines.h) ```cpp +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif - #define BLYNK_PRINT Serial #define BLYNK_WM_DEBUG 3 @@ -1235,11 +1302,10 @@ void loop() // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false @@ -1462,7 +1528,7 @@ The following is the sample terminal output when running example [ESP8266WM_MRD_ ``` Starting ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU -Blynk_WM SSL for ESP8266 v1.2.0 +Blynk_WM SSL for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFD0002 multiResetDetectorFlag = 0xFFFD0002 @@ -1542,7 +1608,7 @@ BBBBBB ``` Starting ESP8266WM_MRD_Config using LittleFS with SSL on ESP8266_NODEMCU -Blynk_WM SSL for ESP8266 v1.2.0 +Blynk_WM SSL for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFC0003 multiResetDetectorFlag = 0xFFFC0003 @@ -1604,7 +1670,7 @@ The following is the sample terminal output when running example [DHT11ESP8266_S ``` Starting DHT11ESP8266_SSL using LittleFS with SSL on ESP8266_NODEMCU -Blynk_WM SSL for ESP8266 v1.2.0 +Blynk_WM SSL for ESP8266 v1.3.0 ESP_DoubleResetDetector v1.1.1 [293] Hostname=ESP8266-DHT11-SSL [316] LoadCfgFile @@ -1662,7 +1728,7 @@ The following is the sample terminal output when running example [ESP32WM_MRD_Co ``` Starting ESP32WM_MRD_Config using LITTLEFS without SSL on ESP32_DEV -Blynk_WM for ESP32 v1.2.0 +Blynk_WM for ESP32 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1739,7 +1805,7 @@ BBBBBB ``` Starting ESP32WM_MRD_Config using LITTLEFS without SSL on ESP32_DEV -Blynk_WM for ESP32 v1.2.0 +Blynk_WM for ESP32 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFC0003 multiResetDetectorFlag = 0xFFFC0003 @@ -1797,7 +1863,7 @@ ets Jun 8 2016 00:22:57 ``` Starting ESP32WM_MRD_Config using LITTLEFS without SSL on ESP32_DEV -Blynk_WM for ESP32 v1.2.0 +Blynk_WM for ESP32 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1921,7 +1987,7 @@ The following is the sample terminal output when running example [DHT11ESP8266_S ``` Starting DHT11ESP32_SSL using LITTLEFS with SSL on ESP32_DEV -Blynk_WM SSL for ESP32 v1.2.0 +Blynk_WM SSL for ESP32 v1.3.0 ESP_DoubleResetDetector v1.1.1 [346] Hostname=ESP32-DHT11-SSL [385] LoadCfgFile @@ -1985,7 +2051,7 @@ Blynk.resetAndEnterConfigPortal(); ``` Starting ESP8266WM_MRD_ForcedConfig using LittleFS without SSL on ESP8266_NODEMCU -Blynk_WM for ESP8266 v1.2.0 +Blynk_WM for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -2071,7 +2137,7 @@ Non-Persistent CP will be removed after first reset, even you didn't enter the C ``` Starting ESP8266WM_MRD_ForcedConfig using LittleFS without SSL on ESP8266_NODEMCU -Blynk_WM for ESP8266 v1.2.0 +Blynk_WM for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -2153,7 +2219,7 @@ Blynk.resetAndEnterConfigPortalPersistent(); ``` Starting ESP8266WM_MRD_ForcedConfig using LittleFS without SSL on ESP8266_NODEMCU -Blynk_WM for ESP8266 v1.2.0 +Blynk_WM for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -2240,7 +2306,7 @@ Persistent CP will remain after resets. The only way to get rid of Config Portal ``` Starting ESP8266WM_MRD_ForcedConfig using LittleFS without SSL on ESP8266_NODEMCU -Blynk_WM for ESP8266 v1.2.0 +Blynk_WM for ESP8266 v1.3.0 ESP_MultiResetDetector v1.1.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -2300,6 +2366,182 @@ Saving config file OK ``` +--- + +### 7. ESP8266WM_MRD_ForcedConfig using LITTLEFS with SSL on ESP8266_NODEMCU + +The following is the sample terminal output when running example [ESP8266WM_MRD_ForcedConfig](examples/ESP8266WM_MRD_ForcedConfig) on **ESP8266_NODEMCU**. Please note that this fix the SSL issue with Blynk Cloud Server. + +``` +Starting ESP8266WM_MRD_ForcedConfig using LittleFS with SSL on ESP8266_NODEMCU +Blynk_WM SSL for ESP8266 v1.3.0 +ESP_MultiResetDetector v1.1.1 +[267] Set CustomsStyle to : +[289] Set CustomsHeadElement to : +[296] 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 +[339] Hostname=8266-Master-Controller +[361] LoadCfgFile +[361] OK +[361] ======= Start Stored Config Data ======= +[361] Hdr=SSL_ESP8266,BrdName=ESP8266 +[361] SSID=HueNet1,PW=12345678 +[363] SSID1=HueNet2,PW1=12345678 +[366] Server=blynk-cloud.com,Token=token1 +[372] Server1=blynk-cloud.com,Token1=token2 +[378] Port=9443 +[379] ======= End Config Data ======= +[383] CCSum=0x2fa3,RCSum=0x2fa3 +[390] LoadCredFile +[391] CrR:pdata=default-mqtt-server,len=34 +[391] CrR:pdata=1883,len=6 +[393] CrR:pdata=default-mqtt-username,len=34 +[397] CrR:pdata=default-mqtt-password,len=34 +[401] CrR:pdata=default-mqtt-SubTopic,len=34 +[405] CrR:pdata=default-mqtt-PubTopic,len=34 +[409] OK +[410] CrCCsum=0x29a6,CrRCsum=0x29a6 +[413] Valid Stored Dynamic Data +[416] Hdr=SSL_ESP8266,BrdName=ESP8266 +[420] SSID=HueNet1,PW=12345678 +[423] SSID1=HueNet2,PW1=12345678 +[425] Server=blynk-cloud.com,Token=token1 +[431] Server1=blynk-cloud.com,Token1=token2 +[438] Port=9443 +[439] ======= End Config Data ======= +[442] Check if isForcedCP +[450] LoadCPFile +[450] OK +[450] bg: noConfigPortal = true +[450] Connecting MultiWifi... +[6667] WiFi connected after time: 1 +[6667] SSID: HueNet1, RSSI = -46 +[6667] Channel: 2, IP address: 192.168.2.92 +[6668] bg: WiFi OK. Try Blynk +[6669] + ___ __ __ + / _ )/ /_ _____ / /__ + / _ / / // / _ \/ '_/ + /____/_/\_, /_//_/_/\_\ + /___/ v0.6.1 on NodeMCU + +[22695] NTP time: Mon Apr 19 06:36:31 2021 +[22695] BlynkArduinoClient.connect: Connecting to blynk-cloud.com:9443 +[23153] Ready (ping: 1ms). +[23245] Connected to Blynk Server = blynk-cloud.com, Token = token1 +[23245] bg: WiFi+Blynk OK + +Blynk ESP8266 using LittleFS connected. +Board Name : ESP8266 +Stop multiResetDetecting +Saving config file... +Saving config file OK +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 +BBBB +``` + +--- + +### 8. ESP32WM_MRD_Config using LITTLEFS with SSL on ESP32S2_DEV + +The following is the sample terminal output when running example [ESP32WM_MRD_Config](examples/ESP32WM_MRD_Config) on **ESP8266_NODEMCU**. Please note that this fix the SSL issue with Blynk Cloud Server and runs on new **ESP32-S2 using LittleFS** using esp32 core v1.0.6+ (not official release v1.0.6, but master release as of 2021/04/19). + + +``` +Starting ESP32WM_MRD_Config using LITTLEFS with SSL on ESP32S2_DEV +Blynk_WM SSL for ESP32 v1.3.0 +ESP_MultiResetDetector v1.1.1 +[134394] Set CustomsStyle to : +[134417] Set CustomsHeadElement to : +[134424] 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 +[134657] Hostname=ESP32-Master-Controller +[134695] LoadCfgFile +[134700] OK +[134700] ======= Start Stored Config Data ======= +[134700] Hdr=SSL_ESP32,BrdName=ESP8266 +[134700] SSID=HueNet1,PW=12345678 +[134701] SSID1=HueNet2,PW1=12345678 +[134704] Server=account.duckdns.org,Token=token1 +[134710] Server1=account.duckdns.org,Token1=token2 +[134717] Port=9443 +[134719] ======= End Config Data ======= +[134722] CCSum=0x33eb,RCSum=0x33eb +[134738] LoadCredFile +[134742] CrR:pdata=default-mqtt-server,len=34 +[134743] CrR:pdata=1883,len=6 +[134743] CrR:pdata=default-mqtt-username,len=34 +[134743] CrR:pdata=default-mqtt-password,len=34 +[134747] CrR:pdata=default-mqtt-SubTopic,len=34 +[134751] CrR:pdata=default-mqtt-PubTopic,len=34 +[134755] OK +[134756] CrCCsum=0x29a6,CrRCsum=0x29a6 +[134760] Valid Stored Dynamic Data +[134763] Hdr=SSL_ESP32,BrdName=ESP8266 +[134766] SSID=HueNet1,PW=12345678 +[134769] SSID1=HueNet2,PW1=12345678 +[134773] Server=account.duckdns.org,Token=token1 +[134779] Server1=account.duckdns.org,Token1=token2 +[134786] Port=9443 +[134787] ======= End Config Data ======= +[134791] Check if isForcedCP +[134806] LoadCPFile +[134811] OK +[134811] bg: noConfigPortal = true +[134811] Connecting MultiWifi... +[144534] WiFi connected after time: 1 +[144534] SSID: HueNet1, RSSI = -38 +[144534] Channel: 2, IP address: 192.168.2.157 +[144535] bg: WiFi OK. Try Blynk +[144536] + ___ __ __ + / _ )/ /_ _____ / /__ + / _ / / // / _ \/ '_/ + /____/_/\_, /_//_/_/\_\ + /___/ v0.6.1 on ESP32 + +[145549] NTP time: Mon Apr 19 05:11:59 2021 +[145549] BlynkArduinoClient.connect: Connecting to account.duckdns.org:9443 +[146810] Certificate OK +[146826] Ready (ping: 15ms). +[146895] Connected to Blynk Server = account.duckdns.org, Token = token1 +[146895] bg: WiFi+Blynk OK + +Blynk ESP32 using LittleFS connected +Board Name : ESP8266 +Stop multiResetDetecting +Saving config file... +Saving config file OK +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 +``` + + --- --- @@ -2338,6 +2580,13 @@ Sometimes, the library will only work if you update the board core to the latest ## Releases +### Major Releases v1.3.0 + +1. Add **LittleFS and SPIFFS** support to new **ESP32-S2** boards (**Arduino ESP32C3_DEV**). Check [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). +2. Add **EEPROM and SPIFFS** support to new **ESP32-C3** boards (**Arduino ESP32C3_DEV**). Check [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). +3. Fix SSL issue with Blynk Cloud Server +4. Update examples + ### Major Releases v1.2.0 1. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header. @@ -2518,14 +2767,16 @@ Submit issues to: [Blynk_WM issues](https://github.com/khoih-prog/Blynk_WM/issue 18. Configurable Config Portal Title 19. Re-structure all examples to separate Credentials / Defines / Dynamic Params / Code so that you can change Credentials / Dynamic Params quickly for each device. 20. Add **LittleFS** support to ESP8266 as SPIFFS deprecated since **ESP8266 core 2.7.1.** -21. Add **LittleFS** support to ESP32 using [LITTLEFS](https://github.com/lorol/LITTLEFS) Library.\ +21. Add **LittleFS** support to ESP32 using [LITTLEFS](https://github.com/lorol/LITTLEFS) Library. 22. Add support to MultiDetectDetector and MRD-related examples 23. Clean-up all compiler warnings possible. 24. Add Table of Contents 25. Add Version String 26. Add functions to control Config Portal from software or Virtual Switches. -27. Add support to **ESP32-S2 (ESP32-S2 Saola, AI-Thinker ESP-12K, etc.) using EEPROM** +27. Add support to **ESP32-S2 (ESP32-S2 Saola, AI-Thinker ESP-12K, etc.) using EEPROM, LittleFS and SPIFFS** 28. Configurable **Customs HTML Headers**, including Customs Style, Customs Head Elements, CORS Header +29. Add support to **ESP32-C3 using EEPROM and SPIFFS** +30. Fix SSL issue with Blynk Cloud Server by using SSL in unsecured mode. --- --- diff --git a/examples/AM2315_ESP32_SSL/AM2315_ESP32_SSL.ino b/examples/AM2315_ESP32_SSL/AM2315_ESP32_SSL.ino index 6da6c12..f2c34f7 100644 --- a/examples/AM2315_ESP32_SSL/AM2315_ESP32_SSL.ino +++ b/examples/AM2315_ESP32_SSL/AM2315_ESP32_SSL.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" diff --git a/examples/AM2315_ESP32_SSL/defines.h b/examples/AM2315_ESP32_SSL/defines.h index 3587522..979f9c7 100644 --- a/examples/AM2315_ESP32_SSL/defines.h +++ b/examples/AM2315_ESP32_SSL/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license *****************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -28,11 +50,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/AM2315_ESP8266/AM2315_ESP8266.ino b/examples/AM2315_ESP8266/AM2315_ESP8266.ino index a6d6dcf..f7a5cb3 100644 --- a/examples/AM2315_ESP8266/AM2315_ESP8266.ino +++ b/examples/AM2315_ESP8266/AM2315_ESP8266.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" diff --git a/examples/Blynk_WM_Template/Blynk_WM_Template.ino b/examples/Blynk_WM_Template/Blynk_WM_Template.ino index aa72cd8..c18e628 100644 --- a/examples/Blynk_WM_Template/Blynk_WM_Template.ino +++ b/examples/Blynk_WM_Template/Blynk_WM_Template.ino @@ -8,7 +8,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -34,6 +34,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ // Sketch uses Arduino IDE-selected ESP32 and ESP8266 to select compile choices @@ -86,6 +88,32 @@ * the BlynkSimpleEsp... and ...WiFiManager libraries, the ESP32 and ESP8266. */ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + +#if !( defined(ESP32) || defined(ESP8266) ) + #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" +#endif + #define SERIAL_SPEED 230400 #define SKETCH_NAME "Blynk_WM_Template" @@ -176,11 +204,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include - #if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS + #if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/DHT11ESP32/DHT11ESP32.ino b/examples/DHT11ESP32/DHT11ESP32.ino index 2482aeb..af59c23 100644 --- a/examples/DHT11ESP32/DHT11ESP32.ino +++ b/examples/DHT11ESP32/DHT11ESP32.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,12 +33,14 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/DHT11ESP32/defines.h b/examples/DHT11ESP32/defines.h index f8d0759..669d026 100644 --- a/examples/DHT11ESP32/defines.h +++ b/examples/DHT11ESP32/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license *****************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -28,11 +50,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino b/examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino index 83f6b2b..39eebbc 100644 --- a/examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino +++ b/examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,12 +33,14 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/DHT11ESP32_SSL/defines.h b/examples/DHT11ESP32_SSL/defines.h index bdb983e..c3e0cb2 100644 --- a/examples/DHT11ESP32_SSL/defines.h +++ b/examples/DHT11ESP32_SSL/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license *****************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -28,11 +50,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/DHT11ESP8266/DHT11ESP8266.ino b/examples/DHT11ESP8266/DHT11ESP8266.ino index 16ac6a7..4964659 100644 --- a/examples/DHT11ESP8266/DHT11ESP8266.ino +++ b/examples/DHT11ESP8266/DHT11ESP8266.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,12 +33,14 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino b/examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino index 3d27da7..d92a75e 100644 --- a/examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino +++ b/examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,11 +33,13 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino b/examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino index 318efec..e419b37 100644 --- a/examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino +++ b/examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,12 +33,14 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP32WM_Config/ESP32WM_Config.ino b/examples/ESP32WM_Config/ESP32WM_Config.ino index b1552de..3114764 100644 --- a/examples/ESP32WM_Config/ESP32WM_Config.ino +++ b/examples/ESP32WM_Config/ESP32WM_Config.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP32WM_Config/defines.h b/examples/ESP32WM_Config/defines.h index 28fdd30..a16e62b 100644 --- a/examples/ESP32WM_Config/defines.h +++ b/examples/ESP32WM_Config/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license *****************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -25,17 +47,15 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false #endif - #if !( USE_SPIFFS || USE_LITTLEFS) // EEPROM_SIZE must be <= 2048 and >= CONFIG_DATA_SIZE (currently 172 bytes) #define EEPROM_SIZE (2 * 1024) diff --git a/examples/ESP32WM_ForcedConfig/ESP32WM_ForcedConfig.ino b/examples/ESP32WM_ForcedConfig/ESP32WM_ForcedConfig.ino index 7a1abce..04b16fd 100644 --- a/examples/ESP32WM_ForcedConfig/ESP32WM_ForcedConfig.ino +++ b/examples/ESP32WM_ForcedConfig/ESP32WM_ForcedConfig.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP32WM_ForcedConfig/defines.h b/examples/ESP32WM_ForcedConfig/defines.h index ad67495..7910f7a 100644 --- a/examples/ESP32WM_ForcedConfig/defines.h +++ b/examples/ESP32WM_ForcedConfig/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license *****************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -26,11 +48,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/ESP32WM_MRD_Config/ESP32WM_MRD_Config.ino b/examples/ESP32WM_MRD_Config/ESP32WM_MRD_Config.ino index 3fedf8b..5ce3565 100644 --- a/examples/ESP32WM_MRD_Config/ESP32WM_MRD_Config.ino +++ b/examples/ESP32WM_MRD_Config/ESP32WM_MRD_Config.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; @@ -126,7 +128,11 @@ void setup() Serial.begin(115200); while (!Serial); +#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) + delay(2000); +#else delay(200); +#endif #if (USE_LITTLEFS) Serial.print(F("\nStarting ESP32WM_MRD_Config using LITTLEFS")); diff --git a/examples/ESP32WM_MRD_Config/defines.h b/examples/ESP32WM_MRD_Config/defines.h index 0ccc5db..cb5bf06 100644 --- a/examples/ESP32WM_MRD_Config/defines.h +++ b/examples/ESP32WM_MRD_Config/defines.h @@ -9,11 +9,33 @@ Licensed under MIT license ********************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif #define BLYNK_PRINT Serial @@ -60,11 +82,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/ESP32WM_MRD_ForcedConfig/ESP32WM_MRD_ForcedConfig.ino b/examples/ESP32WM_MRD_ForcedConfig/ESP32WM_MRD_ForcedConfig.ino index 2b8a28d..13a7d85 100644 --- a/examples/ESP32WM_MRD_ForcedConfig/ESP32WM_MRD_ForcedConfig.ino +++ b/examples/ESP32WM_MRD_ForcedConfig/ESP32WM_MRD_ForcedConfig.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP32WM_MRD_ForcedConfig/defines.h b/examples/ESP32WM_MRD_ForcedConfig/defines.h index 0ccc5db..bfa21a8 100644 --- a/examples/ESP32WM_MRD_ForcedConfig/defines.h +++ b/examples/ESP32WM_MRD_ForcedConfig/defines.h @@ -9,13 +9,34 @@ Licensed under MIT license ********************************************************************************************************************************/ +/* + // To add something similar to this for ESP32-C3 + #if CONFIG_IDF_TARGET_ESP32 + const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26}; + #elif CONFIG_IDF_TARGET_ESP32S2 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #elif CONFIG_IDF_TARGET_ESP32C3 + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #endif + */ + #ifndef defines_h #define defines_h -#ifndef ESP32 +#if !( defined(ESP32) ) #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #define BOARD_TYPE "ESP32-S2" +#elif ( ARDUINO_ESP32C3_DEV ) + // https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-gpio.c + #warning ESP32-C3 boards not fully supported yet. Only SPIFFS and EEPROM OK. Tempo esp32_adc2gpio to be replaced + const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; + #define BOARD_TYPE "ESP32-C3" +#else + #define BOARD_TYPE "ESP32" #endif - #define BLYNK_PRINT Serial #define BLYNK_WM_DEBUG 3 @@ -60,11 +81,10 @@ // (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager // Those above #define's must be placed before #include -#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_PROS2 || ARDUINO_MICROS2 ) - // Currently, ESP32-S2 only supporting EEPROM. Will fix to support LittleFS and SPIFFS +#if ( ARDUINO_ESP32C3_DEV ) + // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS #define USE_LITTLEFS false - #define USE_SPIFFS false - #warning ESP32-S2 only support supporting EEPROM now. + #define USE_SPIFFS true #else #define USE_LITTLEFS true #define USE_SPIFFS false diff --git a/examples/ESP8266WM_Config/ESP8266WM_Config.ino b/examples/ESP8266WM_Config/ESP8266WM_Config.ino index 4761ff6..f3b65b9 100644 --- a/examples/ESP8266WM_Config/ESP8266WM_Config.ino +++ b/examples/ESP8266WM_Config/ESP8266WM_Config.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP8266WM_Config/defines.h b/examples/ESP8266WM_Config/defines.h index 809d478..3827e85 100644 --- a/examples/ESP8266WM_Config/defines.h +++ b/examples/ESP8266WM_Config/defines.h @@ -13,7 +13,7 @@ #define defines_h #ifndef ESP8266 - #error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting. +#error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting. #endif #define BLYNK_PRINT Serial @@ -32,22 +32,22 @@ #define USE_SPIFFS false #if USE_LITTLEFS - //LittleFS has higher priority - #define CurrentFileFS "LittleFS" - #ifdef USE_SPIFFS - #undef USE_SPIFFS - #endif - #define USE_SPIFFS false +//LittleFS has higher priority +#define CurrentFileFS "LittleFS" +#ifdef USE_SPIFFS +#undef USE_SPIFFS +#endif +#define USE_SPIFFS false #elif USE_SPIFFS - #define CurrentFileFS "SPIFFS" +#define CurrentFileFS "SPIFFS" #endif #if !( USE_LITTLEFS || USE_SPIFFS) - // EEPROM_SIZE must be <= 4096 and >= CONFIG_DATA_SIZE (currently 172 bytes) - #define EEPROM_SIZE (4 * 1024) - // EEPROM_START + CONFIG_DATA_SIZE must be <= EEPROM_SIZE - #define EEPROM_START 768 +// EEPROM_SIZE must be <= 4096 and >= CONFIG_DATA_SIZE (currently 172 bytes) +#define EEPROM_SIZE (4 * 1024) +// EEPROM_START + CONFIG_DATA_SIZE must be <= EEPROM_SIZE +#define EEPROM_START 768 #endif ///////////////////////////////////////////// @@ -75,9 +75,9 @@ #define USE_SSL false #if USE_SSL - #include +#include #else - #include +#include #endif #define PIN_LED 2 // Pin D4 mapped to pin GPIO2/TXD1 of ESP8266, NodeMCU and WeMoS, control on-board LED diff --git a/examples/ESP8266WM_ForcedConfig/ESP8266WM_ForcedConfig.ino b/examples/ESP8266WM_ForcedConfig/ESP8266WM_ForcedConfig.ino index fda1a3f..9da7c62 100644 --- a/examples/ESP8266WM_ForcedConfig/ESP8266WM_ForcedConfig.ino +++ b/examples/ESP8266WM_ForcedConfig/ESP8266WM_ForcedConfig.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server *****************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP8266WM_MRD_Config/ESP8266WM_MRD_Config.ino b/examples/ESP8266WM_MRD_Config/ESP8266WM_MRD_Config.ino index ec0c172..3d07a9c 100644 --- a/examples/ESP8266WM_MRD_Config/ESP8266WM_MRD_Config.ino +++ b/examples/ESP8266WM_MRD_Config/ESP8266WM_MRD_Config.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -33,6 +33,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ #include "defines.h" @@ -40,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/examples/ESP8266WM_MRD_ForcedConfig/ESP8266WM_MRD_ForcedConfig.ino b/examples/ESP8266WM_MRD_ForcedConfig/ESP8266WM_MRD_ForcedConfig.ino index 7abd1e1..4d7a0c5 100644 --- a/examples/ESP8266WM_MRD_ForcedConfig/ESP8266WM_MRD_ForcedConfig.ino +++ b/examples/ESP8266WM_MRD_ForcedConfig/ESP8266WM_MRD_ForcedConfig.ino @@ -7,7 +7,7 @@ Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM Licensed under MIT license - Version: 1.1.3 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,9 @@ 1.1.1 K Hoang 16/01/2021 Add functions to control Config Portal from software or Virtual Switches 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP + 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ #include "defines.h" @@ -39,7 +42,7 @@ #include "dynamicParams.h" #include -#include +#include // https://github.com/adafruit/DHT-sensor-library DHT dht(DHT_PIN, DHT_TYPE); BlynkTimer timer; diff --git a/pics/Blynk_ESP32_C3_Support.png b/pics/Blynk_ESP32_C3_Support.png new file mode 100644 index 0000000..d8d1b22 Binary files /dev/null and b/pics/Blynk_ESP32_C3_Support.png differ diff --git a/src/BlynkSimpleEsp32_SSL_WM.h b/src/BlynkSimpleEsp32_SSL_WM.h index 211d933..5bde197 100644 --- a/src/BlynkSimpleEsp32_SSL_WM.h +++ b/src/BlynkSimpleEsp32_SSL_WM.h @@ -16,7 +16,7 @@ @date Jan 2015 @brief - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -42,6 +42,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ #ifndef BlynkSimpleEsp32_SSL_WM_h @@ -51,7 +53,7 @@ #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. #endif -#define BLYNK_WM_VERSION "Blynk_WM SSL for ESP32 v1.2.0" +#define BLYNK_WM_VERSION "Blynk_WM SSL for ESP32 v1.3.0" #if defined(BLYNK_SSL_USE_LETSENCRYPT) static const char BLYNK_DEFAULT_ROOT_CA[] = @@ -243,6 +245,14 @@ class BlynkArduinoClientSecure BLYNK_LOG2("NTP time: ", ntpTime); this->client->setCACert(caCert); + + ///////////////////////////////////////// + // KH, New v1.3.0 + if (String(this->domain) == BLYNK_DEFAULT_DOMAIN) + { + this->client->setInsecure(); + } + ///////////////////////////////////////// if (BlynkArduinoClientGen::connect()) { diff --git a/src/BlynkSimpleEsp32_WM.h b/src/BlynkSimpleEsp32_WM.h index d949cd2..d12e6b3 100644 --- a/src/BlynkSimpleEsp32_WM.h +++ b/src/BlynkSimpleEsp32_WM.h @@ -16,7 +16,7 @@ @date Jan 2015 @brief - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -42,6 +42,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ #ifndef BlynkSimpleEsp32_WM_h @@ -51,7 +53,7 @@ #error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting. #endif -#define BLYNK_WM_VERSION "Blynk_WM for ESP32 v1.2.0" +#define BLYNK_WM_VERSION "Blynk_WM for ESP32 v1.3.0" #define BLYNK_SEND_ATOMIC diff --git a/src/BlynkSimpleEsp8266_SSL_WM.h b/src/BlynkSimpleEsp8266_SSL_WM.h index 6870481..22d71c7 100644 --- a/src/BlynkSimpleEsp8266_SSL_WM.h +++ b/src/BlynkSimpleEsp8266_SSL_WM.h @@ -16,7 +16,7 @@ @date Jan 2015 @brief - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -42,6 +42,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ #ifndef BlynkSimpleEsp8266_SSL_WM_h @@ -51,7 +53,7 @@ #error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting. #endif -#define BLYNK_WM_VERSION "Blynk_WM SSL for ESP8266 v1.2.0" +#define BLYNK_WM_VERSION "Blynk_WM SSL for ESP8266 v1.3.0" #include @@ -61,6 +63,7 @@ // 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" #if defined(BLYNK_SSL_USE_LETSENCRYPT) static const unsigned char BLYNK_DEFAULT_CERT_DER[] PROGMEM = @@ -238,7 +241,7 @@ class BlynkArduinoClientSecure if (this->connected()) return true; - // Synchronize time useing SNTP. This is necessary to verify that + // Synchronize time using SNTP. This is necessary to verify that // the TLS certificates offered by the server are currently valid. configTime(0, 0, "pool.ntp.org", "time.nist.gov"); time_t now = time(nullptr); @@ -256,9 +259,18 @@ class BlynkArduinoClientSecure ntpTime.trim(); BLYNK_LOG2("NTP time: ", ntpTime); + ///////////////////////////////////////// + // KH, New v1.3.0 + if (String(this->domain) == BLYNK_DEFAULT_DOMAIN) + { + this->client->setInsecure(); + } + ///////////////////////////////////////// + + // Now try connecting if (BlynkArduinoClientGen::connect()) - { + { if (fingerprint && this->client->verify(fingerprint, this->domain)) { BLYNK_LOG1(BLYNK_F("Fingerprint OK")); @@ -510,8 +522,7 @@ class BlynkWifi void begin(const char *iHostname = "", const char* fingerprint = NULL) { _fingerprint = fingerprint; - - + #define TIMEOUT_CONNECT_WIFI 30000 //Turn OFF diff --git a/src/BlynkSimpleEsp8266_WM.h b/src/BlynkSimpleEsp8266_WM.h index eda8bc5..331428c 100644 --- a/src/BlynkSimpleEsp8266_WM.h +++ b/src/BlynkSimpleEsp8266_WM.h @@ -16,7 +16,7 @@ @date Jan 2015 @brief - Version: 1.2.0 + Version: 1.3.0 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -42,6 +42,8 @@ 1.1.2 K Hoang 28/01/2021 Fix Config Portal and Dynamic Params bugs 1.1.3 K Hoang 31/01/2021 To permit autoreset after timeout if DRD/MRD or non-persistent forced-CP 1.2.0 K Hoang 24/02/2021 Add customs HTML header feature and support to ESP32-S2. + 1.3.0 K Hoang 19/04/2021 Add LittleFS and SPIFFS support to ESP32-S2. Add support to ESP32-C3 without LittleFS + Fix SSL issue with Blynk Cloud Server ********************************************************************************************************************************/ @@ -52,7 +54,7 @@ #error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting. #endif -#define BLYNK_WM_VERSION "Blynk_WM for ESP8266 v1.2.0" +#define BLYNK_WM_VERSION "Blynk_WM for ESP8266 v1.3.0" #include