Chat freely about anything...

User avatar
By tomjuggler
#88421 Does anyone have any tips or tutorial links on the process of porting SPIFFS code to LittleFS?

I did the benchmark tests and am very excited to see how my code runs on the new file system, but it is not a drop-in replacement (I tried) so any help would be appreciated, if anyone else has had experience doing this?

I am using SPIFFS to read a CSV text file, reading in Strings and converting to int - come to think of it, there should be a better way for me to read in some bytes from a file system... Old code :roll: it works though
User avatar
By RichardS
#88429 Very simple, just did it...

//#include "SPIFFS.h"
#include <LITTLEFS.h>
#define SPIFFS LITTLEFS

All instances of SPIFFS.read() SPIFFS.write() SPIFFS.close() SPIFFS.open()
are now
LITTLEFS.read() LITTLEFS.write() LITTLEFS.close() LITTLEFS.open() are now

Its the same usage... they were smart doing this!

RichardS
User avatar
By tomjuggler
#88431 Thanks Richard that is the smart way to do it for sure. After posting the question I did change all the "SPIFFS" in my code to "LittleFS" manually, not expecting it to work, but it did!

Your way is much more elegant, I will be doing that for the rest of my programs that use SPIFFS going f forward, thanks