Closed voloved closed 2 months ago
This goes too deep to try to address this problem. We shouldn't be hacking around in the core watch library loop to fix an issue in Movement. I will dig into this and try to fix the issue without going too deep. Do we have a sense for when this was introduced? I'd much rather revert whatever change caused this than try to work around it.
This issue was first noticed due to https://github.com/joeycastillo/Sensor-Watch/pull/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: