Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By danbicks
#25450 martinayotte,

Have you also a quick bullet point manual upgrade method to include spiffs file and there locations.

Cheers mate, really cool stuff.

Dans
User avatar
By martinayotte
#25453 To avoid taking the whole GitHub (with side-effect risks), I'm using "meld" to compare between gitHub tree and my Arduino IDE tree. After looking the pertinence of changes, I've done cherry picking of only changes required to make SPIFFS working. Mainly the new FS*.* files, new interrupts.h, spiff_config.h, spiffs_api.cpp, spiffs_hal.cpp and a portion of the changes in Arduino.h. Restart the IDE to make sure files are reparsed, and sketch coding ...

In my sketch, I've mounted the SPIFFS, did a dirOpen, open file for write (actually, I've test "append" mode too), then open same file for read.

Code: Select all        SPIFFS.begin();
        Dir dir = SPIFFS.openDir("/data");
        while (dir.next()) {
          Serial.println(dir.fileName());
        }
        File f = SPIFFS.open("/Tourlou.txt", "a");
        if (!f) {
          Serial.println("Can't open Tourlou.txt !\r\n");         
        }
        else {
          String str = "Il etait une fois ...\r\n";
          f.write((uint8_t *)str.c_str(), str.length());
          f.close();
        }
        File f = SPIFFS.open("/Tourlou.txt", "r");
        if (!f) {
          Serial.println("Can't open Tourlou.txt !\r\n");         
        }
        else {
          char buf[1024];
          f.read((uint8_t *)buf, sizeof(buf));
          f.close();
          Serial.println(buf);
        }


Some caveats of the SPIFFS I found until now are missing functionalities compare to SdFat :
I wish that we get fileSize() and modifiedDate() methods in future versions.

EDIT : In fact, adding the fileSize() method was pretty trivial. Done in less than 10 mins.
The modifiedDate() won't be so easy ... :(
User avatar
By danbicks
#25465 martinayotte,


Awesome work, I will study this in detail. Make a back up of existing structure before I start tinkering. Brilliant work mate.
How does this all effect the heap? Did you do any checks on this.

Cheers

Dans