TransWikia.com

Store & retrieve parameters after sketch update

Arduino Asked on September 25, 2021

I have a Generic code for some IOT devices which vary in some parameters ( lets say it is only its MQTT name and subscriptions).

Since I use OTA to update sketch, I’m looking for a way to A) write those parameters into the ESP32/ ESP8266 FS, and B) They will survive an update.

My only solution come into mind is using an SD card which does not get erased after OTA, and I’m looking for a way doing it not involving SD or external memory.

Guy

One Answer

There is no need for an SD card. You can write all relevant parameters into a file in SPIFFS (e.g. json if you like) before starting the OTA update. During initialization you read the file and set the parameters accordingly. SPIFFS does not get erased when doing an update (at least that's true for the OTA library that I'm using). If it does get erased in your case, there probably is an option in the OTA lib to disable flash erase, just like there is the same option when uploading a sketch via serial.

Answered by Sim Son on September 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP