Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This issue was first noticed due to #387. This PR introduced reading and writing to the backup register in order to store birthdate and location. Its implementation is correct, but it did uncover a small bug.
On startup, we call
app_setup
, which writes the data inmovement_state
to the backup registers. This is good and at this point, those registers contain the defaults. However,app_setup
also gets called when we wake from sleep. This means that the values inmovement_state
overwrite the backups. This is okay for the settings, as settings pass their pointer and get modified in every watch face, somovement_state.settings
is always up-to-date.; birthdate and location don't have that luxury.This PR moves the function that writes to the backup out of
app_setup
and into the line right above whereapp_setup
gets called inmain
. There are 3 places whereapp_setup
gets called on the watch:main
,sleep
, anddeep_sleep
, so only including this function inmain
seems appropriate.The first commit in this PR also does this, but by reading the backup register before rewriting it on wake. This is a smaller change as no new functions are added, but a worse implementation. This is due to the watch reading the backup on wake, and then just writing what it just read back to the register.
This has been tested on hardware by: