Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if factory reset occurs in app? (IDFGH-9379) #10753

Closed
wuyuanyi135 opened this issue Feb 12, 2023 · 4 comments
Closed

Check if factory reset occurs in app? (IDFGH-9379) #10753

wuyuanyi135 opened this issue Feb 12, 2023 · 4 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@wuyuanyi135
Copy link
Contributor

Is your feature request related to a problem?

I need to perform some extra initialization after factory reset. I want to check if factory reset occurs in the app.

Describe the solution you'd like.

Provide an API to tell if this is the first boot-up after factory reset.

Describe alternatives you've considered.

I have considered using a dummy nvs partition that will be set after boot. On factory reset this partition will be erased, so that the app will know this is the first boot after factory reset. However, this solution seems a bit tedious.

Additional context.

No response

@wuyuanyi135 wuyuanyi135 added the Type: Feature Request Feature request for IDF label Feb 12, 2023
@github-actions github-actions bot changed the title Check if factory reset occurs in app? Check if factory reset occurs in app? (IDFGH-9379) Feb 12, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 12, 2023
@igrr
Copy link
Member

igrr commented Feb 12, 2023

I have considered using a dummy nvs partition that will be set after boot. On factory reset this partition will be erased, so that the app will know this is the first boot after factory reset. However, this solution seems a bit tedious.

Unfortunately I don't think there's anything significantly simpler in terms of the underlying implementation. You could replace an NVS partition with a single-sector data partition, and write data into it as a token of the "first boot". But if you are using NVS for any other purpose, it's probably easier to reuse that partition and store the "first boot" token there.

@wuyuanyi135
Copy link
Contributor Author

@igrr Thanks for confirming!

@chipweinberger
Copy link
Contributor

I personally use a boot count.

I increment the nvs boot count setting on each boot.

If zero, i know it's the first boot after reset.

@wuyuanyi135
Copy link
Contributor Author

nt.

I increment the nvs boot count setting on each boot.

If zero, i know it's the first boo

Thanks for your suggestion!

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress and removed Status: Opened Issue is new Status: Selected for Development Issue is selected for development labels Mar 16, 2023
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Mar 24, 2023
espressif-bot pushed a commit to espressif/esp-hal-components that referenced this issue Mar 25, 2023
espressif-bot pushed a commit to espressif/esp-hal-components that referenced this issue Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

5 participants