You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This approach, while common in many ESP-IDF examples, is IMHO not suitable for production environments. It leads to a problematic behavior: if older firmware, which is incompatible with the current NVS partition version, attempts to access the NVS, the partition will be erased and reinitialized. This results in the potential loss of critical data stored in the NVS.
Instead of automatically erasing and reinitializing the NVS upon encountering ESP_ERR_NVS_NEW_VERSION_FOUND, I propose to propagate the error back to the caller. This allows the calling function or application to handle the error in a manner that is appropriate for its specific requirements.
The text was updated successfully, but these errors were encountered:
Hmm. How would you even show this error if the app can't even read its own data? Shouldn't you prevent the firmware flashing if it is too old in the first place? Or allow flashing but before that warn the user that all data would be lost?
Maybe you can create an API sketch outlining your idea. The API should contain some way to forcibly erase and initialize the partition in case of one of these errors though.
Currently whenever
nvs_flash_init()
returnsESP_ERR_NVS_NEW_VERSION_FOUND
the code erases the flash and then rerunsnvs_flash_init()
:This approach, while common in many ESP-IDF examples, is IMHO not suitable for production environments. It leads to a problematic behavior: if older firmware, which is incompatible with the current NVS partition version, attempts to access the NVS, the partition will be erased and reinitialized. This results in the potential loss of critical data stored in the NVS.
Instead of automatically erasing and reinitializing the NVS upon encountering ESP_ERR_NVS_NEW_VERSION_FOUND, I propose to propagate the error back to the caller. This allows the calling function or application to handle the error in a manner that is appropriate for its specific requirements.
The text was updated successfully, but these errors were encountered: