How can I store permanent data with spiffs on esp32?
Example:
Variablefloat_one 126.658
Variablefloat_two 2.85
Variablefloat_....
These variables use my program, I can change these variables on STONE display. When I push the save button, then write the variables into storage. And when the esp32 restarts, I read the variables in the setup loop.
I use float and int variables.
I would like to use one file. And I save and read the name of the variable in the file.
Can I do it?
Thanks!
How can I store permanent data with spiffs on esp32?
Re: How can I store permanent data with spiffs on esp32?
Yes, you can do that. But 2 comments:
First, I wouldn't use SPIFFS for anything. If you must use a filesystem, use LittleFS or FFat. See e.g. https://forum.arduino.cc/t/esp32-mit-sp ... phe/621573
Second, in your case I would NOT use any filesystem. Instead, use the NVS space for storage employing the Preferences lib.
https://docs.espressif.com/projects/esp ... flash.html
https://github.com/espressif/arduino-es ... references
I am storing single variables, bigger structs, and big 2k strings. For small sizes (~ 100 bytes) it is clearly faster than a file system, for bigger ones it is about on par. Corruption has so far never been an issue for me with NVS, but it surely has with a filesystem. I am using a file system for data files 10k ... 1000k.
First, I wouldn't use SPIFFS for anything. If you must use a filesystem, use LittleFS or FFat. See e.g. https://forum.arduino.cc/t/esp32-mit-sp ... phe/621573
Second, in your case I would NOT use any filesystem. Instead, use the NVS space for storage employing the Preferences lib.
https://docs.espressif.com/projects/esp ... flash.html
https://github.com/espressif/arduino-es ... references
I am storing single variables, bigger structs, and big 2k strings. For small sizes (~ 100 bytes) it is clearly faster than a file system, for bigger ones it is about on par. Corruption has so far never been an issue for me with NVS, but it surely has with a filesystem. I am using a file system for data files 10k ... 1000k.
Re: How can I store permanent data with spiffs on esp32?
Thanks for the reply, I'll adopt your advice!
Who is online
Users browsing this forum: No registered users and 60 guests