-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Alarm persist to flash #1367
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
Alarm persist to flash #1367
Conversation
ac410fa to
3969a4a
Compare
… to file Support for InfiniTimeOrg/InfiniTime#1367 which is a rebase/improvement of InfiniTimeOrg/InfiniTime#1333 by @ght The PR adds saving and restoring alarm state to the SPI NOR flash. So the AlarmController needs the FileSystem-controller to work. To support both the current `main` branch and the "save-alarm-to-file" PR pass the Filesystem controller conditionally, only if `Controller::FS` is mentioned in the `AlarmController.h` file
… to file Support for InfiniTimeOrg/InfiniTime#1367 which is a rebase/improvement of InfiniTimeOrg/InfiniTime#1333 by @ght The PR adds saving and restoring alarm state to the SPI NOR flash. So the AlarmController needs the FileSystem-controller to work. To support both the current `main` branch and the "save-alarm-to-file" PR pass the Filesystem controller conditionally, only if `Controller::FS` is mentioned in the `AlarmController.h` file
3969a4a to
9694ccd
Compare
|
Build size and comparison to main:
|
9694ccd to
89f0664
Compare
|
rebased and squashed on current |
mark9064
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested but looks sensible to me
89f0664 to
299d19f
Compare
mark9064
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested but all LGTM
579be33 to
0d41924
Compare
|
I considered opening a comment on that text you just changed but decided it was too minor LOL |
0d41924 to
ae860cc
Compare
Save the set alarm time to the SPI NOR flash, so it does not reset to the default value when the watch resets, e.g. due to watchdog timeout or reflashing of a new version of InfiniTime. Just like the `Settings.h` `LoadSettingsFromFile()` the previous alarm at boot (if available) and `SaveSettingsToFile()` the current alarm when the `Alarm.h` screen is closed (only if the settings have changed). The alarm-settings file is stored in `.system/alarm.dat`. The `.system` folder is created if it doesn't yet exist. Fixes: #1330
|
There is a segfault or freeze leading to a reboot on the second time when changing the alarm setting and exit the Alarm setting screen. Need to investigate |
Close the `lfs_dir` object for the `.system` dir after usage. Otherwise on the second changed alarm the system will lockup because the `.system` dir is already open and was never closed.
ae860cc to
b0ab1c4
Compare
|
found it, need to close the |
|
Did I miss that or did you only just add .system? |
|
Second. I did add it recently, based in an old Diskussion about where to put pinetime system files and that they shouldn't be in the root for the user to be directly available. JF and Riksu9000 agreed that a subfolder .system is a goog place to put our configs. And the user can put their files at the root |
rebase of #1333 with additional
SaveAlarm()function as described belowSave the set alarm time to the SPI NOR flash, so it does not reset to
the default value when the watch resets, e.g. due to watchdog timeout
or a firmware update
Introduce
SaveAlarm()member function which saves to file only if thealarm setting is changed.
The
alarmChangedboolean flag mimics the behavior ofsettingsChangedflag from
Settings.hAlso mark the
SaveAlarmToFile()Save()SaveSettingsToFilefunction const, as it doesn't changeanything in the
AlarmControllerobject.This PR needs InfiniTimeOrg/InfiniSim#67 to work on
InfiniSimFixes: #1330