Application configuration file

rtborg
Posts: 67
Joined: Wed Oct 23, 2019 6:15 am

Application configuration file

Postby rtborg » Fri Apr 01, 2022 6:57 pm

One of the requirements for a project I am working on is to be able to work with configuration file - the user should be able to upload a JSON or YAML file to the ESP32, which would then parse it and configure its application with details such as:
- IP address
- MQTT broker
- MQTT topics to publish/subscribe to
- Sensor polling interval
- Modbus registers to read and so on

Browsing through the examples, it looks like the simple ESP32 file server is a good starting point. The config files will be relatively large - a few KB. I'd like some advise on how to store them - NVS, SPIFSS, or external storage? Also, my initial idea is to read the complete file on boot, parse it and keep it in RAM for the duration of the application run. If any of the parameters change (MQTT will allow pushing parameters into the device), the RAM buffer will be written back to non-volatile storage.

Further, the device is supposed to support OTA, therefore what would be advisable - to keep the config file as a part of the compiled application, or keep it on separate storage, like SD card?

Thanks and hope my questions make sense.

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

Re: Application configuration file

Postby Baldhead » Mon Nov 18, 2024 10:35 pm

Cool that no one from espressif responded you.

I also have the same doubt.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Application configuration file

Postby ESP_Sprite » Tue Nov 19, 2024 1:07 am

Probably because there's no real advice to give - nvs is an option if you want to break apart the json after uploading, spiffs is also an option to store it integrally, external storage is an option if your board has external storage. In this case, the specifics of the program flow as well as the experience of the programmer (and the hardware in use, as far as external storage goes) is more relevant to pick the tech than a simple 'this is best' can convey.

Who is online

Users browsing this forum: Google [Bot] and 186 guests