Hi
I'm trying to check whether the ESP has reset from an upgrade (USB or OTA) to reset my "reset_counter" variable which is stored in flash.
I tried to detect that from the response from the function nvs_get(). If I get a "value not initialized" then it means I had a code upgrade and I should reset the "reset_counter" variable. But it seems that after I upgrade my code this variable is still initialized !
Can someone help ?
How to detect ESP restart from upgrade
-
- Posts: 1729
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: How to detect ESP restart from upgrade
How about storing a "firmware version" in NVS?
If versionFromNvs != thisAppsVersion then there was an 'upgrade'.
If versionFromNvs != thisAppsVersion then there was an 'upgrade'.
Re: How to detect ESP restart from upgrade
Yes I have thought of that, but I was looking for something non-user dependent (during testing you don't change versions all the time).
If there is no other way I will do it this way, I just thought that it should work this way
For example ATMEL μCs have a register that defines the reason of a reset (WD,brown-out,external etc)
If there is no other way I will do it this way, I just thought that it should work this way
For example ATMEL μCs have a register that defines the reason of a reset (WD,brown-out,external etc)
-
- Posts: 1729
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: How to detect ESP restart from upgrade
esp_app_get_description() could help.
-> https://docs.espressif.com/projects/esp ... set-reasonFor example ATMEL μCs have a register that defines the reason of a reset (WD,brown-out,external etc)
But that's probably of no use in your case.
Re: How to detect ESP restart from upgrade
What about running a checksum on the flash, and comparing that value to the last value saved.Yes I have thought of that, but I was looking for something non-user dependent (during testing you don't change versions all the time).
Re: How to detect ESP restart from upgrade
What about running a checksum on the flash, and comparing that value to the last value saved.Yes I have thought of that, but I was looking for something non-user dependent (during testing you don't change versions all the time).
Re: How to detect ESP restart from upgrade
What about running a checksum on the flash, and comparing that value to the last value saved.Yes I have thought of that, but I was looking for something non-user dependent (during testing you don't change versions all the time).
Re: How to detect ESP restart from upgrade
Thanks all ! I will have to implement one of the above
Who is online
Users browsing this forum: No registered users and 76 guests