Alarm persist to flash neroburner#1345
Closed
NeroBurner wants to merge 6 commits intodevelopfrom
Closed
Conversation
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. Size impact: +204 (400332 -> 400536)
Also reverts the attempt at deferring saving the alarm data for reduced
flash writes, in order to reduce complexity.
Split `AlarmController.State()` into `.IsAlerting()` and `.IsEnabled()`,
since the two properties are conceptually independent and it makes code
much cleaner:
```diff
- if (alarmController.State() == Controllers::AlarmController::AlarmState::Alerting) { ...
+ if (alarmController.IsAlerting()) { ...
- if (alarmController.State() == AlarmController::AlarmState::Set) { ...
+ if (alarmController.IsEnabled()) { ...
```
See the removed `switch` for another example.
Size impact: +44 (400536 -> 400580)
This avoids writing the time to flash for every single change. Size impact: +16 (400580 -> 400596)
This reverts commit ce296ec.
Introduce `SaveAlarm()` member function which saves to file only if the alarm setting is changed. The `alarmChanged` boolean flag mimics the behavior of `settingsChanged` flag from `Settings.h` Additionally save the alarm status when the enabled flag is toggled immediately. To be sure a disabled Alarm stays disabled on a crash. Also mark the `SaveAlarmToFile()` function const, as it doesn't change anything in the `AlarmController` object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
implementation for review for PR #1333