diff --git a/README.md b/README.md index 62b7c17..19c0656 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ * [5.1 MRD/DRD => Open Config Portal](#51-mrddrd--open-config-portal) * [5.2 Config Data Saved => Connection to Adafruit MQTT](#52-config-data-saved--connection-to-adafruit-mqtt) * [6. ESPAsync_WiFi on ESP32S3_DEV](#6-ESPAsync_WiFi-on-ESP32S3_DEV) **New** + * [7. ESPAsync_WiFi on ESP32C3_DEV using LittleFS](#7-ESPAsync_WiFi-on-ESP32C3_DEV-using-LittleFS) **New** * [Debug](#debug) * [Troubleshooting](#troubleshooting) * [Issues](#issues) @@ -160,7 +161,7 @@ This [**ESPAsync_WiFiManager_Lite** library](https://github.com/khoih-prog/ESPAs 1. **ESP8266 and ESP32-based boards using EEPROM, SPIFFS or LittleFS**. 2. **ESP32-S2 (ESP32-S2 Saola, AI-Thinker ESP-12K, etc.) using EEPROM, SPIFFS or LittleFS**. - 3. **ESP32-C3 (ARDUINO_ESP32C3_DEV) using EEPROM or SPIFFS**. + 3. **ESP32-C3 (ARDUINO_ESP32C3_DEV) using EEPROM, SPIFFS or LittleFS**. 4. **ESP32-S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.) using EEPROM, SPIFFS or LittleFS**. --- @@ -996,13 +997,13 @@ void loop() ///////////////////////////////////////////// // LittleFS has higher priority than 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 true -#else +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) #define USE_LITTLEFS true #define USE_SPIFFS false +#elif defined(ARDUINO_ESP32C3_DEV) + // For core v1.0.6-, ESP32-C3 only supporting SPIFFS and EEPROM. To use v2.0.0+ for LittleFS + #define USE_LITTLEFS false + #define USE_SPIFFS true #endif ///////////////////////////////////////////// @@ -1257,7 +1258,7 @@ This is the terminal output when running [**ESPAsync_WiFi_MQTT**](examples/ESPAs ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1332,7 +1333,7 @@ NNN Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1424,7 +1425,7 @@ This is the terminal output when running [**ESPAsync_WiFi_MQTT**](examples/ESPAs ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP8266_NODEMCU -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1499,7 +1500,7 @@ NNN Starting ESPAsync_WiFi_MQTT using LittleFS on ESP8266_NODEMCU -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1590,7 +1591,7 @@ This is the terminal output when running [**ESPAsync_WiFi_MQTT**](examples/ESPAs ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32S2_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1703,7 +1704,7 @@ entry 0x4004c190 Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32S2_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1806,7 +1807,7 @@ This is the terminal output when running [**ESPAsync_WiFi_MQTT**](examples/ESPAs ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32S2_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFC0003 multiResetDetectorFlag = 0xFFFC0003 @@ -1849,7 +1850,7 @@ entry 0x4004c190 ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32S2_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1905,7 +1906,7 @@ This is the terminal output when running [**ESPAsync_WiFi_MQTT**](examples/ESPAs ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFC0003 multiResetDetectorFlag = 0xFFFC0003 @@ -1950,7 +1951,7 @@ NNNN NNNNN NNNNN N ``` Starting ESPAsync_WiFi_MQTT using LittleFS on ESP32_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.3.0 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -1997,7 +1998,7 @@ This is the terminal output when running [**ESPAsync_WiFi**](examples/ESPAsync_W ``` Starting ESPAsync_WiFi using LittleFS on ESP32S3_DEV -ESPAsync_WiFiManager_Lite v1.8.0 +ESPAsync_WiFiManager_Lite v1.8.1 ESP_MultiResetDetector v1.2.1 LittleFS Flag read = 0xFFFE0001 multiResetDetectorFlag = 0xFFFE0001 @@ -2029,6 +2030,47 @@ Saving config file OK H ``` +--- + +### 7. [ESPAsync_WiFi](examples/ESPAsync_WiFi) on ESP32C3_DEV using LittleFS + + +This is the terminal output when running [**ESPAsync_WiFi**](examples/ESPAsync_WiFi) example on **ESP32C3_DEV** using LittleFS + + +``` +Starting ESPAsync_WiFi using LittleFS on ESP32C3_DEV +ESPAsync_WiFiManager_Lite v1.8.1 +ESP_MultiResetDetector v1.3.0 +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 +[WML] Hdr=ESP_WM_LITE,SSID=HueNet1,PW=password +[WML] SSID1=HueNet2,PW1=password +[WML] BName=ESP32_C3 +[WML] Hdr=ESP_WM_LITE,SSID=HueNet1,PW=password +[WML] SSID1=HueNet2,PW1=password +[WML] BName=ESP32_C3 +[WML] WiFi connected after time: 0 +[WML] SSID=HueNet1,RSSI=-21 +[WML] Channel=2,IP=192.168.2.85 +H +Your stored Credentials : +Blynk Server1 = account.duckdns.org +Token1 = token1 +Blynk Server2 = account.ddns.net +Token2 = token2 +Port = 8080 +MQTT Server = mqtt.duckdns.org +Stop multiResetDetecting +Saving config file... +Saving config file OK +HHH +``` --- @@ -2108,6 +2150,9 @@ Submit issues to: [ESPAsync_WiFiManager_Lite issues](https://github.com/khoih-pr 24. Fix the blocking issue in loop() with configurable `WIFI_RECON_INTERVAL` 25. Optimize library code by using `reference-passing` instead of `value-passing` 26. Add support to **ESP32-S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.) using EEPROM, SPIFFS or LittleFS** +27. Add `LittleFS` support to **ESP32-C3** +28. Use `ESP32-core's LittleFS` library instead of `Lorol's LITTLEFS` library for ESP32 core v2.0.0+ + --- --- diff --git a/changelog.md b/changelog.md index 9b332dd..7f4896d 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Release v1.8.1](#release-v181) * [Release v1.8.0](#release-v180) * [Major Release v1.7.0](#major-release-v170) * [Release v1.6.0](#release-v160) @@ -29,6 +30,11 @@ ## Changelog +### Release v1.8.1 + +1. Add LittleFS support to `ESP32-C3`. +2. Use `ESP32-core's LittleFS` library instead of `Lorol's LITTLEFS` library for ESP32 core v2.0.0+ + ### Release v1.8.0 1. Add support to `ESP32-S3` (`ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3`, etc.) using [ESP32 core, esp32-s3-support branch, v2.0.2+](https://github.com/espressif/arduino-esp32/tree/esp32-s3-support) diff --git a/examples/ESPAsync_WiFi/defines.h b/examples/ESPAsync_WiFi/defines.h index 092c6d2..a34e7af 100644 --- a/examples/ESPAsync_WiFi/defines.h +++ b/examples/ESPAsync_WiFi/defines.h @@ -55,13 +55,13 @@ ///////////////////////////////////////////// // LittleFS has higher priority than 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 true -#else +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) #define USE_LITTLEFS true #define USE_SPIFFS false +#elif defined(ARDUINO_ESP32C3_DEV) + // For core v1.0.6-, ESP32-C3 only supporting SPIFFS and EEPROM. To use v2.0.0+ for LittleFS + #define USE_LITTLEFS false + #define USE_SPIFFS true #endif ///////////////////////////////////////////// diff --git a/examples/ESPAsync_WiFi_MQTT/defines.h b/examples/ESPAsync_WiFi_MQTT/defines.h index aaed1ff..2279b61 100644 --- a/examples/ESPAsync_WiFi_MQTT/defines.h +++ b/examples/ESPAsync_WiFi_MQTT/defines.h @@ -55,13 +55,13 @@ ///////////////////////////////////////////// // LittleFS has higher priority than 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 true -#else +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) #define USE_LITTLEFS true #define USE_SPIFFS false +#elif defined(ARDUINO_ESP32C3_DEV) + // For core v1.0.6-, ESP32-C3 only supporting SPIFFS and EEPROM. To use v2.0.0+ for LittleFS + #define USE_LITTLEFS false + #define USE_SPIFFS true #endif ///////////////////////////////////////////// diff --git a/library.json b/library.json index c8a054a..a747d13 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESPAsync_WiFiManager_Lite", - "version": "1.8.0", + "version": "1.8.1", "keywords": "wifi, wi-fi, Async, Async-WebServer, Async-WiFiManager, Communication, MultiWiFi, multi-wifi, ESP32, ESP32-S2, ESP32-S3, esp32-c3, ESP8266, Credentials, config-portal, DoubleReset, MultiReset, Detector, dynamic-params, dynamic, customs-header", "description": "Library using AsyncWebServer to configure MultiWiFi/Credentials at runtime for ESP32 (including ESP32-S2, ESP32-S3 and ESP32-C3) and ESP8266 boards. You can also specify DHCP HostName, static AP and STA IP. Use much less memory compared to full-fledge WiFiManager. Config Portal will be auto-adjusted to match the number of dynamic custom parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Credentials are saved in LittleFS, SPIFFS or EEPROM. New powerful-yet-simple-to-use feature to enable adding dynamic custom parameters from sketch and input using the same Config Portal. Double or MultiDetectDetector as well as Virtual Switches feature permits entering Config Portal as requested. Configurable Customs HTML Headers, including Customs Style, Customs Head Elements, CORS Header", "authors": diff --git a/library.properties b/library.properties index 39530c7..2508d51 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESPAsync_WiFiManager_Lite -version=1.8.0 +version=1.8.1 author=Khoi Hoang maintainer=Khoi Hoang license=MIT diff --git a/src/ESPAsync_WiFiManager_Lite.h b/src/ESPAsync_WiFiManager_Lite.h index 1c6acfc..3faeb3f 100644 --- a/src/ESPAsync_WiFiManager_Lite.h +++ b/src/ESPAsync_WiFiManager_Lite.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager_Lite Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -23,6 +23,7 @@ 1.6.0 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library. Fix bug. 1.7.0 K Hoang 09/01/2022 Fix the blocking issue in loop() with configurable WIFI_RECON_INTERVAL 1.8.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.8.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ *****************************************************************************************************************************/ #pragma once @@ -38,7 +39,13 @@ #warning Using ESP32_S2. #define USING_ESP32_S2 true #elif ( ARDUINO_ESP32C3_DEV ) - #warning Using ESP32_C3. Only SPIFFS and EEPROM OK. + #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) + #warning Using ESP32_C3 using core v2.0.0+. Either LittleFS, SPIFFS or EEPROM OK. + #else + #warning Using ESP32_C3 using core v1.0.6-. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK. + #endif + + #warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards #define USING_ESP32_C3 true #elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \ defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) ) @@ -47,13 +54,13 @@ #endif #ifndef ESP_ASYNC_WIFI_MANAGER_LITE_VERSION - #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION "ESPAsync_WiFiManager_Lite v1.8.0" + #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION "ESPAsync_WiFiManager_Lite v1.8.1" #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_MAJOR 1 #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_MINOR 8 - #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_PATCH 0 + #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_PATCH 1 - #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_INT 1008000 + #define ESP_ASYNC_WIFI_MANAGER_LITE_VERSION_INT 1008001 #endif #ifdef ESP8266 @@ -90,21 +97,28 @@ #include #include - // To be sure no LittleFS for ESP32-C3 - #if ( ARDUINO_ESP32C3_DEV ) - // Currently, ESP32-C3 only supporting SPIFFS and EEPROM. Will fix to support LittleFS + // To be sure no LittleFS for ESP32-C3 for core v1.0.6- + #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) + // For core v2.0.0+, ESP32-C3 can use LittleFS, SPIFFS or EEPROM + // LittleFS has higher priority than SPIFFS. + // For core v2.0.0+, if not specified any, use better LittleFS + #if ! (defined(USE_LITTLEFS) || defined(USE_SPIFFS) ) + #define USE_LITTLEFS true + #define USE_SPIFFS false + #endif + #elif defined(ARDUINO_ESP32C3_DEV) + // For core v1.0.6-, ESP32-C3 only supporting SPIFFS and EEPROM. To use v2.0.0+ for LittleFS #if USE_LITTLEFS #undef USE_LITTLEFS #define USE_LITTLEFS false #undef USE_SPIFFS #define USE_SPIFFS true #endif - #endif - - // LittleFS has higher priority than SPIFFS. - // But if not specified any, use SPIFFS to not forcing user to install LITTLEFS library - #if ! (defined(USE_LITTLEFS) || defined(USE_SPIFFS) ) - #define USE_SPIFFS true + #else + // For core v1.0.6-, if not specified any, use SPIFFS to not forcing user to install LITTLEFS library + #if ! (defined(USE_LITTLEFS) || defined(USE_SPIFFS) ) + #define USE_SPIFFS true + #endif #endif #if USE_LITTLEFS @@ -114,17 +128,17 @@ // Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h //#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2) #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) - #warning Using ESP32 Core 1.0.6 or 2.0.0+ and LittleFS in ESP_WiFiManager_Lite.h + #warning Using ESP32 Core 1.0.6 or 2.0.0+ // The library has been merged into esp32 core from release 1.0.6 - #include + #include // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS FS* filesystem = &LittleFS; #define FileFS LittleFS #define FS_Name "LittleFS" #else - #warning Using ESP32 Core 1.0.5- and LittleFS in ESPAsync_WiFiManager_Lite.h. You must install LITTLEFS library + #warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library // The library has been merged into esp32 core from release 1.0.6 - #include // https://github.com/lorol/LITTLEFS + #include // https://github.com/lorol/LITTLEFS FS* filesystem = &LITTLEFS; #define FileFS LITTLEFS diff --git a/src/ESPAsync_WiFiManager_Lite_Debug.h b/src/ESPAsync_WiFiManager_Lite_Debug.h index 5d69b7d..181ce47 100644 --- a/src/ESPAsync_WiFiManager_Lite_Debug.h +++ b/src/ESPAsync_WiFiManager_Lite_Debug.h @@ -9,7 +9,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESPAsync_WiFiManager_Lite Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -23,6 +23,7 @@ 1.6.0 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library. Fix bug. 1.7.0 K Hoang 09/01/2022 Fix the blocking issue in loop() with configurable WIFI_RECON_INTERVAL 1.8.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.8.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ *****************************************************************************************************************************/ #ifndef ESPAsync_WiFiManager_Lite_Debug_h