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

Commit

Permalink
v1.8.1 to add LittleFS support to ESP32-C3
Browse files Browse the repository at this point in the history
### 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+
  • Loading branch information
khoih-prog authored Feb 12, 2022
1 parent 66c8967 commit cd01a3e
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 48 deletions.
79 changes: 62 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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**.

---
Expand Down Expand Up @@ -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

/////////////////////////////////////////////
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
```


---
Expand Down Expand Up @@ -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+


---
---
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions examples/ESPAsync_WiFi/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/////////////////////////////////////////////
Expand Down
10 changes: 5 additions & 5 deletions examples/ESPAsync_WiFi_MQTT/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESPAsync_WiFiManager_Lite
version=1.8.0
version=1.8.1
author=Khoi Hoang
maintainer=Khoi Hoang <[email protected]>
license=MIT
Expand Down
50 changes: 32 additions & 18 deletions src/ESPAsync_WiFiManager_Lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
------- ----------- ---------- -----------
Expand All @@ -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
Expand All @@ -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) )
Expand All @@ -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
Expand Down Expand Up @@ -90,21 +97,28 @@
#include <WiFiMulti.h>
#include <ESPAsyncWebServer.h>

// 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
Expand All @@ -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 <LittleFS.h>
#include <LittleFS.h> // 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 <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS

FS* filesystem = &LITTLEFS;
#define FileFS LITTLEFS
Expand Down
3 changes: 2 additions & 1 deletion src/ESPAsync_WiFiManager_Lite_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
------- ----------- ---------- -----------
Expand All @@ -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
Expand Down

0 comments on commit cd01a3e

Please sign in to comment.