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

Don't attempt to save NodeDB on low-batt shutdown to prevent FS corruption #5312

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

thebentern
Copy link
Contributor

Addresses part of #5259 by skipping the NodeDB save on low battery shutdown. This should result in minimal loss of data, because the NodeDB is saved in other domain events within the firmware regularly. Plus in any regard, it's better than potentially losing the whole enchilada.

@todd-herbert we can collaborate on this branch to try to figure out the low voltage warning startup halt, or we work that separately and push this one forward.
I was researching the best ways to persist the status that we shut down due to low battery, so that we can check attempt to run some ADC samples on the next boot. It looks like RTC slow memory could be an option: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/memory-types.html#rtc-slow-memory

@thebentern
Copy link
Contributor Author

Also, I'm going to get a harness setup for my PSU so that I can reproduce this condition on demand hopefully

@dm5tt
Copy link

dm5tt commented Nov 11, 2024

Reproducing it shouldn't be too complicated.

You can start with pulling and plugging the power cable manually into the PSU out and in fast trying to abort the early boot-up sequence.

@todd-herbert
Copy link
Contributor

@dm5tt Do you feel that the corruption is happening on boot, rather than during low power shutdown?

@todd-herbert
Copy link
Contributor

todd-herbert commented Nov 12, 2024

@thebentern I actually hadn't been working on this separately just yet. I got a bit sidetracked looking into whether the battery % reporting is linear enough. It's been a bit of a slow process testing that one.

I think this PR more than makes sense on its own. Catching low voltage at boot can be another job for the future.

@thebentern thebentern marked this pull request as ready for review November 12, 2024 12:17
@thebentern thebentern merged commit a84324c into master Nov 12, 2024
48 checks passed
@thebentern thebentern deleted the dont-save-on-low-batt branch November 12, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants