How to save data to EEPROM (ESP32)

Hi Guys…

I would like to store data into memory like EEPROM how can I do it in mongoose (C++ development)

There is no EEPROM in the ESP32.
Mongoose-OS uses C standard library read/write functions, there is also provision for file logging, to save configuration-like data you can use the configuration functions (see how libraries work), and you can also use a JSON store.

Thanks you for your reply… it’s config_schema right?

In a mos.yml file, yes.

depends what and how much you want to store.

I’ve used mos_sys_config a fair bit which is good, just remember to do the save operation so your settings persist reboot. I’ve found this can get sluggish though.
The great thing about it is the automatic creation of getters and setters when you include the variable in your mos.yml file. You can see an example here where the examples uses mgos_sys_config_get_app_pin()

You can also do the standard C fwrite/fread operations to write files to the FS.

my app config is about 20 variable of float. so mOS config can handle ?

If I perform this action

save_cfg(&mgos_sys_config, &err); /* Writes conf9.json */

after user modify config. it may have chance to roll back to original config I declare in mos.yml like System crash or OTA ?

From memory changes will be applied to conf9.json, which is only overwritten in mos flash operation or a factory reset operation.

Flashing resets to mos.yml default, same as factory reset