-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Limit SPIFFS use (ESP32) #557
Conversation
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spiffs.html "SPIFFS is able to reliably utilize only around 75% of assigned partition space."
Although the official sources say that only 75 % of SPIFFS can be reliably used, I'll keep the old Reason: even 1.5 MB isn't plenty for data logging (when you don't have an SD card in your system), and having that reduced to <1.2 MB for "reliable use" only makes matters worse in that regard. Also, in my "testing" (extremely limited, just one test case!), using more than 75 % of SPIFFS did work: With 631516 bytes of SPIFFS space available, I tried to use /DK1 (c.f. #542 (comment)) on a datalog.txt of 740704 bytes, only to receive the error message "Not enough space on device" with the 25 % reserve requirement. After reducing the reserve to the original 10000 bytes (< 1.6 %), /DK1 did work - albeit it took two attempts, and it did take longer than expected:
For completeness: It's up to you to decide whether to merge this PR or not. |
The question is whether a switch to LittleFS would make more sense? |
Having just read about LittleFS, I'd say: In the long term, using it seems to be the way to go. Right now, it seems easier to use SPIFFS instead, and SPIFFS seems to be "good enough" in most cases. |
I haven't seen the need for it so far as well, but if it means that the already limited space on a ESP32 without SD card is further reduced by 25%, it might be worth looking at it more closely. I read somewhere that the library calls are mostly compatible, so it might be as easy as changing the included library, but I'll see when I find time to look at it more closely... |
It actually is just a drop-in replacement. Tested it on my ESP32 Olimex with its internal memory and logging, displaying and removing log files work fine. So I'll keep the minimum at 10000 bytes for now. |
Since you did a few tests regarding speed, I wonder if LittleFS will produce noticeable gains as well... |
Shouldn't be necessary to add LittleFS as it is part of the ESP core v2. If that's the library you've added, that's the predecessor and it's outdated: |
OK, I've just searched for "littlefs" in the library manager of my Arduino 1.8.19 IDE: nothing found. |
Using a different computer, I can confirm that I didn't have to install LittleFS. :) Some more timings:
=> In my tests, LittleFS has always been considerably faster than SPIFFS. Also, with LittleFS files up to 1400 KB could be written, as opposed to just 1200 KB with SPIFFS. => #557 (comment) Considering that LittleFS doesn't require an extra installation and that the code change would be trivial, you should definitely consider changing bsb-lan usage of SPIFFS to LittleFS. I have not done any reliability testing for LittleFS, though! Do you want me to prepare a pull request? :) |
I've already included in the master repo when I closed this PR ;)... |
But thanks for testing, the advantages are more than obvious now... |
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spiffs.html
"SPIFFS is able to reliably utilize only around 75% of assigned partition space."