-
Notifications
You must be signed in to change notification settings - Fork 149
Please test with LITTLEFS for esp32 #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
Ah, one thing I found is that the LittleFS does not unlink (delete) files if they have opened descriptors.
|
I discoverd this too, it's by design in LitteFS (see lorol/LITTLEFS#22). I fixed in my fork with code below (sorry should have done a PR). void FactoryResetService::factoryReset() {
#ifdef ESP32
/*
* Based on LITTLEFS. Modified by proddy
* Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2 when platformio catches up
*/
File root = fs->open(FS_CONFIG_DIRECTORY);
File file;
while (file = root.openNextFile()) {
char * pathStr = strdup(file.name());
file.close();
fs->remove(pathStr);
}
#elif defined(ESP8266)
Dir configDirectory = fs->openDir(FS_CONFIG_DIRECTORY);
while (configDirectory.next()) {
String path = FS_CONFIG_DIRECTORY;
path.concat("/");
path.concat(configDirectory.fileName());
fs->remove(path);
}
#endif
RestartService::restartNow();
} |
Thx for the example Proddy, does the strdup need a free in your example (i'm never sure)? My plan was to wait for the IDF 4.2 release of arduino-esp32 before bothering with adding LITTLEFS support. I wasn't experiencing issues with SPIFFS but I appreciate that others have. Seeing as the 4.2 release may be a way off... might be worth rethinking. Would probably have to ditch the documentation around manual FS uploads. I'm assuming the PIO tooling doesn't allow for that with a custom FS library - anyone have any experience? |
yeah should be free'd but no point since the ESP is restarted ;) |
Uh oh!
There was an error while loading. Please reload this page.
Hi @rjwats
I tested with minor tweak of platformio.ini and ESPFS.h, at least it builds fine with my "hacky" esp32 library here: https://github.com/lorol/LITTLEFS
See the PlatformIO note at the the bottom of README.
You can add also to build_flags -D CONFIG_LITTLEFS_FOR_IDF_3_2 until the core repositories get moved to newer IDF
Update:
It seems to be actually working. Few "errors" on serial console, but they are due to:
https://github.com/espressif/arduino-esp32/blob/4638628873a061c36faffebe4d146d13f960076d/libraries/FS/src/vfs_api.cpp#L57
I don't know what to do with them :) SPIFFS is different than LittleFS and we have to live with that ...
... see also here: espressif/arduino-esp32#4138
Update2:
I forgot to mention I needed to add a /config folder (and a dummy holder.txt file in it) to project data directory before flash the FS image. Otherwise it will not be able to create and save the config jsons. I guess again SPIFFS creates folder/file at once (as file) while LittleFS not, unless we make-up backwards as on ESP8266 is done.
It is maybe the best to have all 7 x .json files created as empty files under /config folder. Probably other tweaks ...
BTW the error [E][WiFiGeneric.cpp:117] wifiLowLevelInit(): esp_wifi_init 4353 is present also with standard SPIFFS setting
Appreciate your validation.
Thank you,
The text was updated successfully, but these errors were encountered: