Re: Save 5 large arrays to FLASH
Posted: Sun Apr 15, 2018 2:09 pm
Don't worry about flash sectors. SPIFFS looks after all that.
If the data is binary byte data and the arrays are fixed size then the simple method would be to just write the binary data buffer direct to the file (not as strings like println) and you can then use read to retrieve it back to a buffer.
Edit: Example
Write
Read
If the data is binary byte data and the arrays are fixed size then the simple method would be to just write the binary data buffer direct to the file (not as strings like println) and you can then use read to retrieve it back to a buffer.
Edit: Example
Code: Select all
#define len 256
unsigned char buffer[len]
File f;
Write
Code: Select all
f = SPIFFS.open("/buffer", "w");
f.write(buffer, 256);
f.close();
Read
Code: Select all
File f = SPIFFS.open("/buffer", "r");
f.read(buffer, 256);
f.close();