fix(settings): preserve quick resume timeout preference (#2101)
## Summary ### **What is the goal of this PR?** This fixes an unintended settings side effect when cycling the `Sleep Screen` option through `Quick Resume`. Previously, selecting `Sleep Screen = Quick Resume` globally forced `Quick Resume on Timeout = ON` and left it enabled even after the user toggled `Sleep Screen` to another option within the same settings session. Now the auto-enable behavior is scoped to the Settings screen session: - If `Quick Resume on Timeout` was already `ON` when entering Settings, it stays `ON`. - If it was `OFF`, selecting `Sleep Screen = Quick Resume` temporarily turns it `ON`. - If the user then switches away from `Quick Resume`, it turns back `OFF`. ### **What changes are included?** - Removes the global logic that permanently forced `Quick Resume on Timeout` to `ON` whenever `Sleep Screen` was set to `Quick Resume`, even if it was just due to toggling through the options. - Adds Settings-screen session tracking so `Quick Resume on Timeout` is only auto-enabled while the user has `Sleep Screen = Quick Resume`. - Restores `Quick Resume on Timeout` back to `OFF` when the user switches away, but only if it was `OFF` when they entered Settings. - Preserves existing `ON` timeout preferences. - Same behavior applies to the web settings ## Additional Context - Tested this on device and via the settings UI --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**< YES >**_
This commit is contained in:
@@ -79,12 +79,6 @@ void CrossPointSettings::validateFrontButtonMapping(CrossPointSettings& settings
|
||||
}
|
||||
}
|
||||
|
||||
void CrossPointSettings::normalizeDependentSettings(CrossPointSettings& settings) {
|
||||
if (settings.sleepScreen == SLEEP_SCREEN_MODE::QUICK_RESUME) {
|
||||
settings.quickResumeSleepScreen = QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
bool CrossPointSettings::saveToFile() const {
|
||||
Storage.mkdir("/.crosspoint");
|
||||
return JsonSettingsIO::saveSettings(*this, SETTINGS_FILE_JSON);
|
||||
|
||||
Reference in New Issue
Block a user