Hi there,
in our project, we use the HTTP OTA library (with three partitions: factory, ota_1, ota2) to implement an update mechanism, as well as a factory reset mechanism that resets the code to the factory partition. Also, we have a FAT file system that is not yet touched by the factory reset - that means it is not a "true" factory reset in that the device does not operate exactly as it did after manufacturing if the file system has changed since then. I thought of the following approach to implement it:
1. Add a second "factory" FAT file system partition that contains the file system created during manufacturing, it shall never be written to
2. Erase the "operational" FAT file system on factory resets. Check for its existence on startup. If it does not exist (after a factory reset), format it and copy over the files from the factory FAT file system
Is this the right way to go? How should I check if the operational FAT file system exists? Should I check for the existence of an NVS key value pair (that is also erased on factory reset)?
I also thought about keeping a single FAT file system (no extra factory FAT file system) and setting it to the factory state during the factory reset. But that is not possible with the ESP-IDF bootloader's factory reset mechanism and I do not want to build a sophisticated factory reset into the main code because the factory reset mechanism could be broken in an update, possibly bricking the device.
Thanks in advance!
How to handle file system on factory reset
-
- Posts: 9
- Joined: Mon Nov 27, 2023 8:11 am
Re: How to handle file system on factory reset
It's a good idea to check for the existence of the operational file system on startup. You can use various methods to do this, such as checking for the presence of certain files or directories that are expected to exist in the operational file system.
Who is online
Users browsing this forum: No registered users and 456 guests