ESPUI
ESPUI copied to clipboard
"Use the built-in LITTLEFS library"
I know this has already been asked but I'm a beginner and I followed the steps on the other issue (#179), and I can't get it to work.
How do I use the built-in LITTLEFS libary?
I'm using PlattformIO and I tried the PIO example. As I got the same error I added the lib_deps from the installation section.
lib_deps = ESPUI ESP Async WebServer ESPAsyncTCP # (or AsyncTCP on ESP32) LittleFS_esp32 # (ESP32 only)
This produced the same "Use the built-in LITTLEFS library"
error.
Thank you for your help.
On the latest platformio releases LittleFS has become a built-in library. So your platformio.ini may need editing.
-
Open file platformio.ini for editing.
-
Remove text line that says:
lorol/LittleFS_esp32@^1.0.6
orLittleFS_esp32
-
In place of the removed line, add new library dependency:
LittleFS @ ^2.0.0
- Thomas
3. LittleFS @ ^2.0.0
Thanks for your fast reply, unfortunately I still can't get it to work.
with these
[env:esp32] platform = espressif32 framework = arduino board = esp32dev lib_deps = ESPUI LittleFS @ ^2.0.0 bblanchon/ArduinoJson @ ^6.18.5 me-no-dev/ESP Async WebServer @ ^1.2.3
I still get this error, after I followed the instructions in #179
.pio/libdeps/esp32/ESPUI/src/ESPUI.cpp: In member function 'void ESPUIClass::beginSPIFFS(const char*, const char*, const char*, uint16_t)': .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp:1194:5: error: 'beginLittleFS' was not declared in this scope beginLittleFS(_title, username, password, port); ^~~~~~~~~~~~~ .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp:1194:5: note: suggested alternative: 'beginLITTLEFS' beginLittleFS(_title, username, password, port); ^~~~~~~~~~~~~ beginLITTLEFS .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp: At global scope: .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp:1197:6: error: no declaration matches 'void ESPUIClass::beginLittleFS(const char*, const char*, const char*, uint16_t)' void ESPUIClass::beginLittleFS(const char* _title, const char* username, const char* password, uint16_t port) ^~~~~~~~~~ .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp:1197:6: note: no functions named 'void ESPUIClass::beginLittleFS(const char*, const char*, const char*, uint16_t)' In file included from .pio/libdeps/esp32/ESPUI/src/ESPUI.cpp:1: .pio/libdeps/esp32/ESPUI/src/ESPUI.h:218:7: note: 'class ESPUIClass' defined here class ESPUIClass ^~~~~~~~~~ Compiling .pio\build\esp32\FrameworkArduino\Stream.cpp.o Compiling .pio\build\esp32\FrameworkArduino\StreamString.cpp.o Compiling .pio\build\esp32\FrameworkArduino\Tone.cpp.o *** [.pio\build\esp32\lib5df\ESPUI\ESPUI.cpp.o] Error 1
Without following the instructions I get
.pio/libdeps/esp32/LittleFS_esp32/src/LITTLEFS.cpp: In member function 'virtual bool LITTLEFSImpl::exists(const char*)': .pio/libdeps/esp32/LittleFS_esp32/src/LITTLEFS.cpp:44:28: error: no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])' File f = open(path, "r"); ^ In file included from .pio/libdeps/esp32/LittleFS_esp32/src/LITTLEFS.cpp:17: C:/Users/risin/.platformio/packages/framework-arduinoespressif32/libraries/FS/src/vfs_api.h:38:17: note: candidate: 'virtual fs::FileImplPtr VFSImpl::open(const char*, const char*, bool)' FileImplPtr open(const char* path, const char* mode, const bool create) override; ^~~~ C:/Users/risin/.platformio/packages/framework-arduinoespressif32/libraries/FS/src/vfs_api.h:38:17: note: candidate expects 3 arguments, 2 provided Archiving .pio\build\esp32\lib3e7\libESPUI.a Archiving .pio\build\esp32\lib739\libLittleFS.a Compiling .pio\build\esp32\FrameworkArduino\FirmwareMSC.cpp.o Compiling .pio\build\esp32\FrameworkArduino\FunctionalInterrupt.cpp.o *** [.pio\build\esp32\libd3a\LittleFS_esp32\LITTLEFS.cpp.o] Error 1
One problem I see is that it appears you have renamed the ESPUI's beginLITTLEFS() function to beginLittleFS(). You need to restore the original function name (beginLITTLEFS) in your files.
Also, PLEASE use code braces when you post the platformio compiler messages.
- Thomas
I set up a new Plattform IO project, pasted the build filesystem example in a main.cpp and set up the following plattformio.ini. I got the following result.
Dependency Graph
|-- ESPUI @ 2.1.1
| |-- ESP Async WebServer @ 1.2.3
| | |-- AsyncTCP @ 1.1.1
| | |-- FS @ 2.0.0
| | |-- WiFi @ 2.0.0
| |-- ArduinoJson @ 6.19.4
| |-- WiFi @ 2.0.0
| |-- ArduinoOTA @ 2.0.0
| | |-- Update @ 2.0.0
| | |-- WiFi @ 2.0.0
| | |-- ESPmDNS @ 2.0.0
| | | |-- WiFi @ 2.0.0
| |-- AsyncTCP @ 1.1.1
| |-- LittleFS @ 2.0.0
| | |-- FS @ 2.0.0
|-- LittleFS @ 2.0.0
| |-- FS @ 2.0.0
|-- ESP Async WebServer @ 1.2.3
| |-- AsyncTCP @ 1.1.1
| |-- FS @ 2.0.0
| |-- WiFi @ 2.0.0
|-- AsyncTCP @ 1.1.1
Building in release mode
Yet I get the following error.
Error Message
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In function 'void listDir(const char*, uint8_t)':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:30:17: error: 'LITTLEFS' was not declared in this scope
File root = LITTLEFS.open(dirname);
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In member function 'void ESPUIClass::list()':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:118:10: error: 'LITTLEFS' was not declared in this scope
if (!LITTLEFS.begin())
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:118:10: note: suggested alternative: 'beginLITTLEFS'
if (!LITTLEFS.begin())
^~~~~~~~
beginLITTLEFS
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:134:20: error: 'LITTLEFS' was not declared in this scope
Serial.println(LITTLEFS.totalBytes());
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:134:20: note: suggested alternative: 'beginLITTLEFS'
Serial.println(LITTLEFS.totalBytes());
^~~~~~~~
beginLITTLEFS
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In function 'void deleteFile(const char*)':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:150:19: error: 'LITTLEFS' was not declared in this scope
bool exists = LITTLEFS.exists(path);
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In function 'void writeFile(const char*, const char*)':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:209:17: error: 'LITTLEFS' was not declared in this scope
File file = LITTLEFS.open(path, FILE_WRITE);
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In member function 'void ESPUIClass::prepareFileSystem()':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:286:5: error: 'LITTLEFS' was not declared in this scope
LITTLEFS.format();
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:286:5: note: suggested alternative: 'beginLITTLEFS'
LITTLEFS.format();
^~~~~~~~
beginLITTLEFS
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp: In member function 'void ESPUIClass::beginLITTLEFS(const char*, const char*, const char*, uint16_t)':
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:1216:20: error: 'LITTLEFS' was not declared in this scope
bool fsBegin = LITTLEFS.begin();
^~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/ESPUI/src/ESPUI.cpp:1216:20: note: suggested alternative: 'beginLITTLEFS'
bool fsBegin = LITTLEFS.begin();
^~~~~~~~
beginLITTLEFS
plattformio.Ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = ./src
data_dir = ../../data
[env]
lib_extra_dirs = ../../
board_build.filesystem = littlefs
; Additional scripts: Usage: see https://github.com/s00500/ESPUI/issues/144#issuecomment-1005135077
;extra_scripts =
; LittleFSBuilder.py
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps =
ESPUI
LittleFS @ ^2.0.0
ESP Async WebServer
AsyncTCP # (or AsyncTCP on ESP32)
If this isn't asking too much, could you please upload a plattformio project folder where the library is successfully used? I am kind of out of ideas I'd really like to use this great looking library.
Thank you very much for your help.
As mentioned, Platformio's latest littlefs library has renamed its ESP32 functions. So if the ESP32 is used then ESPUI needs some edits.
That is to say, the LITTLEFS case has changed and is now identical to the ESP8266 builds. Objects previously named "LITTLEFS" are now named "LittleFS".
Here are the ESP32 revisions based on your error log (edit ESPUI.cpp):
Before: LITTLEFS.open(dirname) Now: LittleFS.open(dirname)
Before: LITTLEFS.begin() Now: LittleFS.begin()
Before: LITTLEFS.totalBytes() Now: LittleFS.totalBytes()
Before: LITTLEFS.exists(path) Now: LittleFS.exists(path)
Before: LITTLEFS.format() Now: LittleFS.format()
And so on.
Note that all the examples above are functions declared by the littlefs library. ESPUI also has some function names that have LITTLEFS wording in them, but to keep things simple do not change ESPUI's function names. For example, beginLITTLEFS() is not a littlefs library function, it belongs to ESPUI, so its name does not change.
If this isn't asking too much, could you please upload a plattformio project folder where the library is successfully used?
I don't believe any active devs are using LITTLEFS, so it's hard to say how long you would have to wait for someone to create the PR for that.
Instead, I recommend that you do the edits yourself, starting with the examples posted above. If you have more errors you cannot resolve on your own then feel free to ask for advice here.
- Thomas
I have converted this to use the built in LittleFS lib as part of my restructuring.
Even with the new version in platfom io , same error : "Use the built-in LITTLEFS library"
but in Arduino IDE its fine.
Can you help?
Thanks. Marc.
I tried now all the tricks you mentioned, but I still can't get it running (only tried PlatformIO and ESP32). I really would appreciate your help, since I really like this library!
I now get the error:
.pio/libdeps/esp-wrover-kit/LittleFS_esp32/src/LittleFS.cpp: In member function 'virtual bool LITTLEFSImpl::exists(const char*)': .pio/libdeps/esp-wrover-kit/LittleFS_esp32/src/LittleFS.cpp:44:28: error: no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])' File f = open(path, "r");
I also tried to add the additional parameter "false" but I still get other errors.
I also get a lot of "'LittleFS' was not declared in this scope" errors in ESPUI.cpp since you wrote the code for LitteleFS AND LITTLEFS, like here:
#if defined(ESP32) #if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4 File root = LittleFS.open(dirname);** #else File root = LITTLEFS.open(dirname); #endif
Do I have to delete the ESP8266 parts manualy or is there another trick to it?
Would be good if at least one example is working with plattformIO.
Maybe also list again how the platformio.ini should look like, since there are several tips here (and in other issues).
Thanks for your help!
you should not need to delete anything. I will rebuild the examples tomorrow.
Thank you very much!!!
PIO build worked perfectly. What did I do?
- I have the latest VC + PIO
- Deleted all of my ESPUI versions
- Download latest ESPUI from github using the windows tool
- Started up VC
- Opened the "...\MyDocuments\Arduino\ESPUI\pio_examples\gui" folder in VC
- waited for VC to set up the build environment (about 3 minutes)
- did a default build
You do not download it. Platformio downloads it without you taking any action. I suggest you start with a clean directory and follow the steps I took.
Got my problem fixed by adding this in platform.ini file:
lib_ignore = ESP Async WebServer AsyncTCP LittleFS_esp32
Hi Martin,
sorry but it doesn't work:
then:
then I download the latest ESPUI release from GitHub, open the folder you suggest, wait for VSCode to complete and when I build I get:
PIO build worked perfectly. What did I do?
- I have the latest VC + PIO
- Deleted all of my ESPUI versions
- Download latest ESPUI from github using the windows tool
- Started up VC
- Opened the "...\MyDocuments\Arduino\ESPUI\pio_examples\gui" folder in VC
- waited for VC to set up the build environment (about 3 minutes)
- did a default build
Can you show me the errors you got? There is not enough information in that screen shot
Thank you Martin.
This is the output when VSCODE updates:
Already up-to-date.
Updating metadata for the vscode IDE...
Error: Processing esp8266 (platform: espressif8266; board: nodemcuv2; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (4.1.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 @ 3.30101.0 (3.1.1)
- tool-esptool @ 1.413.0 (4.13)
- tool-esptoolpy @ 1.30000.201119 (3.0.0)
- toolchain-xtensa @ 2.100300.220621 (10.3.0)
Converting gui.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
PermissionError: [WinError 5] Accesso negato: '../../Cookies':
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 187:
env.SConscript("$BUILD_SCRIPT")
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "C:\Users\gsaie\.platformio\platforms\espressif8266\builder\main.py", line 237:
target_elf = env.BuildProgram()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 61:
env.ProcessProjectDeps()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 137:
plb = env.ConfigureProjectLibBuilder()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1176:
project.install_dependencies()
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 971:
if lm.get_package(spec):
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 265:
for pkg in self.get_installed():
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 241:
spec = self.build_legacy_spec(pkg.path)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\_legacy.py", line 26:
for name in os.listdir(pkg_dir):
========================= [FAILED] Took 55.45 seconds =========================
Environment Status Duration
------------- -------- ------------
esp8266 FAILED 00:00:55.455
==================== 1 failed, 0 succeeded in 00:00:55.455 ====================
And this is the error upon building (same for the other env):
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (4.1.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 @ 3.30101.0 (3.1.1)
- tool-esptool @ 1.413.0 (4.13)
- tool-esptoolpy @ 1.30000.201119 (3.0.0)
- toolchain-xtensa @ 2.100300.220621 (10.3.0)
Converting gui.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
PermissionError: [WinError 5] Accesso negato: '../../Cookies':
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 187:
env.SConscript("$BUILD_SCRIPT")
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Script\SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "C:\Users\gsaie\.platformio\platforms\espressif8266\builder\main.py", line 237:
target_elf = env.BuildProgram()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 61:
env.ProcessProjectDeps()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 137:
plb = env.ConfigureProjectLibBuilder()
File "C:\Users\gsaie\.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py", line 737:
return self.method(*nargs, **kwargs)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1176:
project.install_dependencies()
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 971:
if lm.get_package(spec):
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 265:
for pkg in self.get_installed():
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\base.py", line 241:
spec = self.build_legacy_spec(pkg.path)
File "C:\Users\gsaie\.platformio\penv\lib\site-packages\platformio\package\manager\_legacy.py", line 26:
for name in os.listdir(pkg_dir):
========================================================================================== [FAILED] Took 32.75 seconds ==========================================================================================
You are dying before the build actually starts. It looks like python is having an issue accessing the directory two levels up from the current directory. That means python or pio was not properly set up. The project you are building is not in control of this.
Some info: https://pcriver.com/tech/permissionerror-winerror-5-access-is-denied-fixed.html
Thank you Martin. But both Python and PIO just install (how do I "properly" do it?). Also reccommended practises in your link didn't work.
The error is the same if VS updates or if I manually build:
PermissionError: [WinError 5] Access denied: '../../Cookies':
There is no Cookies directory in my profile (why the script has to do with cookies, btw?).
Also tried on a freshly installed pc (Win 10) and gives the same exact error.
I have no idea. That is a pio internal operation. Here is a log from an attempt I just did.
So it would seem I have a missing bootloader file which would just be a versioning issue and is easily resolved. But I do not have the permission issue that you are seeing. That would be a problem for the platform IO team.
You are running on Linux right? I also tried on WSL (debian) and after install the logs are good. But when I build it gives another series of errors...
use git to create a new ESPUI instance on my nachine open platformio On platformio, open the espui folder
Can you please give more details? Thanks you very much.
I run on Windows 10. I have never tried to use PIO on Linux.
I suspect PIO is trying to create a cookies directory as it tries to download the supporting files using some version of GIT that you have installed. That is failing because pio or git does not have the permissions needed to create the directory.
Thank you for the insights. I have tried on W10, W11 and Debian (WSL). Do you mind to expand the steps you made, so I try to reproduce them?
use git to create a new ESPUI instance on my machine open platformio On platformio, open the espui folder
I've had a similar issue when building an older project on a new PC. Providing this for anyone that may need it in the future. You can take it or leave it, but it worked for me. My solution:
IDE: Arduino IDE 2.0.4 BOARD: ESP32 Dev Module ESPUI: v2.2.1 LittleFS_esp32: v1.0.6
includes:
#include "FS.h"
#include <LITTLEFS.h>
ino calls:
LITTLEFS.remove(fileName);
file = LITTLEFS.open(fileName, FILE_WRITE);
file = LITTLEFS.open(fileName, FILE_READ);
if(!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)){
ESPUI library (ESPUI.c and ESPUI.h) changes:
Replace All:
#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4
With:
#if 0 //(ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4
Hope this helps someone.
I had the same problem. The solution was to remove the LITTLEFS dependency in the file .pio\libdeps\esp32dev\ESPUI\library.json . Otherwise loads Platformio automatically the LITTLEFS lib. LITTLEFS is only required for ESP32 with a Arduino version lower than 2.0.0, see here.