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.
Application configuration file
Re: Application configuration file
Cool that no one from espressif responded you.
I also have the same doubt.
I also have the same doubt.
-
- Posts: 9905
- Joined: Thu Nov 26, 2015 4:08 am
Re: Application configuration file
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.
Re: Application configuration file
In my case the use case is more simple.ESP_Sprite wrote: ↑Tue Nov 19, 2024 1:07 amProbably 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.
The config file stay in program flash, and if the user change some option in this config file, the file is updated in the flash.
May be use a json file and littlefs.
I would need to reserve a space in the partition table i think.
I'm using OTA too, i don't know if this could cause any problems.
What do you think ?
Last edited by Baldhead on Thu Nov 28, 2024 1:04 am, edited 2 times in total.
-
- Posts: 1987
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Application configuration file
I think using a file (system) for this is most likely unnecessary. NVS may be what you're looking for.
Who is online
Users browsing this forum: Bing [Bot], sign25893 and 41 guests