s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Storing Config in NVM, best practices example

elockman opened this issue · comments

Is your feature request related to a problem? Please describe.
The examples do not store the config in NVM. If the device is rebooted, the config is lost.

Describe the solution you'd like
After looking at the code, it appears the HTML, JS, and CSS are stored in LittleFS, however the config is all stored in RAM. The purpose of ESPUI is presumed to edit configurations, which should be stored in NVM. I understand that these configs can be stored in Flash (LittleFS) or in a separate EEPROM, but I would like to see example code for storing configs with best practices.

Describe alternatives you've considered
One problem I am running into is sender->id changing if an element is added into the configuration. One thought was to add a struct that provides a lookup between the app id and the sender->id. I'm new to this library, and would like to know if anyone has a solution they would like to share. I think there would be more users if the existing UI examples included code to store configs in NVM.

Additional context
I would rather not re-invent the wheel, but if nobody has recommendations I'll come up with something.

@s00500, @ericBcreator, @thomastech,
Do any of you have example code you would be willing to share that pulls and stores configuration data from/to LittleFS?

The callbacks basically provide an id and a value, so you could store config in one or many JSON files using key-value pairs. Some may think a file for each config is an easy solution, but I my thought is one JSON config file, which can also store versioning info.

Any thoughts on best practices for storing config into NVM with the ESPUI library would be appreciated.

Do any of you have example code you would be willing to share that pulls and stores configuration data from/to LittleFS?

I save / restore several config items via LittleFS (and SD Card). See the src/backup.cpp file in my FM transmitter project: https://github.com/thomastech/PixelRadio

  • Thomas

@thomastech that is a huge help. Thank You!