feat(settings): modify "Page as Sleep Screen" to "Quick Resume" options (#2089)
## Summary **What is the goal of this PR?** Adds a clearer Quick Resume sleep-screen flow. The previous “Page as Sleep Screen” behavior is now exposed as a dedicated `Sleep Screen > Quick Resume `option, with the timeout-only behavior controlled by a renamed `Quick Resume on Timeout `setting. **What changes are included?** - Adds `Quick Resume` as a new `Sleep Screen` option. - Renames the old `Page as Sleep Screen` setting to `Quick Resume on Timeout`. - Changes that setting’s choices from `Never / After Timeout / Always` to `OFF / ON`. - Makes `Quick Resume on Timeout = ON` equivalent to the old `After Timeout` behavior. - Makes `Sleep Screen > Quick Resume` equivalent to the old `Always` behavior. - Automatically forces `Quick Resume on Timeout` to `ON` when `Sleep Screen` is set to `Quick Resume`. - Renames internal setting references from `seamlessSleepScreen` to `quickResumeSleepScreen`. - Updates translations for the renamed setting label. **Additional Context** - This is mostly a settings/labeling restructure around existing behavior, not a new rendering path. - The runtime quick-resume behavior still uses the existing saved framebuffer / last-screen sleep flow. - Review focus areas: - Sleep entry behavior from manual sleep vs timeout sleep. - The automatic dependency where selecting `Sleep Screen > Quick Resume` sets `Quick Resume on Timeout` to `ON`. --- ### 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 >**_ --- **New `Quick Resume` option for `Sleep Screen` will automatically set `Quick Resume on Timeout` to `ON`**: <img width="480" height="800" alt="quick resume" src="https://github.com/user-attachments/assets/94c553fd-a122-47a8-add9-f29694f55566" /> **Example where a different sleep screen setting like `Cover` can be used in combination with the `Quick Resume on Timeout` setting**: <img width="480" height="800" alt="cover + quick resume" src="https://github.com/user-attachments/assets/dd18ce18-230b-4b78-808b-ac85f5e7d5d8" />
This commit is contained in:
@@ -79,6 +79,12 @@ 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);
|
||||
|
||||
@@ -24,6 +24,7 @@ class CrossPointSettings {
|
||||
COVER = 3,
|
||||
BLANK = 4,
|
||||
COVER_CUSTOM = 5,
|
||||
QUICK_RESUME = 6,
|
||||
SLEEP_SCREEN_MODE_COUNT
|
||||
};
|
||||
enum SLEEP_SCREEN_COVER_MODE { FIT = 0, CROP = 1, SLEEP_SCREEN_COVER_MODE_COUNT };
|
||||
@@ -155,11 +156,10 @@ class CrossPointSettings {
|
||||
|
||||
enum TILT_PAGE_TURN { TILT_OFF = 0, TILT_NORMAL = 1, TILT_NVERTED = 2, TILT_PAGE_TURN_COUNT };
|
||||
|
||||
enum SEAMLESS_SLEEP_SCREEN {
|
||||
SEAMLESS_NEVER = 0,
|
||||
SEAMLESS_AFTER_TIMEOUT = 1,
|
||||
SEAMLESS_ALWAYS = 2,
|
||||
SEAMLESS_SLEEP_SCREEN_COUNT
|
||||
enum QUICK_RESUME_SLEEP_SCREEN {
|
||||
QUICK_RESUME_NEVER = 0,
|
||||
QUICK_RESUME_AFTER_TIMEOUT = 1,
|
||||
QUICK_RESUME_SLEEP_SCREEN_COUNT
|
||||
};
|
||||
|
||||
// Sleep screen settings
|
||||
@@ -249,8 +249,8 @@ class CrossPointSettings {
|
||||
uint8_t tiltPageTurn = TILT_OFF;
|
||||
// Language setting (Language enum index, default 0 = EN)
|
||||
uint8_t language = 0;
|
||||
// Seamless sleep: keep current content visible with moon icon instead of showing sleep screen
|
||||
uint8_t seamlessSleepScreen = SEAMLESS_NEVER;
|
||||
// Quick Resume: keep current content visible with moon icon instead of showing a static sleep screen.
|
||||
uint8_t quickResumeSleepScreen = QUICK_RESUME_NEVER;
|
||||
|
||||
~CrossPointSettings() = default;
|
||||
|
||||
@@ -275,6 +275,7 @@ class CrossPointSettings {
|
||||
bool loadFromFile();
|
||||
|
||||
static void validateFrontButtonMapping(CrossPointSettings& settings);
|
||||
static void normalizeDependentSettings(CrossPointSettings& settings);
|
||||
|
||||
private:
|
||||
bool loadFromBinaryFile();
|
||||
|
||||
@@ -223,6 +223,10 @@ bool JsonSettingsIO::loadSettings(CrossPointSettings& s, const char* json, bool*
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t quickResumeBeforeNormalize = s.quickResumeSleepScreen;
|
||||
CrossPointSettings::normalizeDependentSettings(s);
|
||||
if (s.quickResumeSleepScreen != quickResumeBeforeNormalize && needsResave) *needsResave = true;
|
||||
|
||||
// Front button remap — managed by RemapFrontButtons sub-activity, not in SettingsList.
|
||||
using S = CrossPointSettings;
|
||||
s.frontButtonBack =
|
||||
|
||||
+3
-3
@@ -106,15 +106,15 @@ inline std::vector<SettingInfo> getSettingsList(const SdCardFontRegistry* regist
|
||||
// --- Display ---
|
||||
SettingInfo::Enum(StrId::STR_SLEEP_SCREEN, &CrossPointSettings::sleepScreen,
|
||||
{StrId::STR_DARK, StrId::STR_LIGHT, StrId::STR_CUSTOM, StrId::STR_COVER, StrId::STR_NONE_OPT,
|
||||
StrId::STR_COVER_CUSTOM},
|
||||
StrId::STR_COVER_CUSTOM, StrId::STR_QUICK_RESUME},
|
||||
"sleepScreen", StrId::STR_CAT_DISPLAY),
|
||||
SettingInfo::Enum(StrId::STR_SLEEP_COVER_MODE, &CrossPointSettings::sleepScreenCoverMode,
|
||||
{StrId::STR_FIT, StrId::STR_CROP}, "sleepScreenCoverMode", StrId::STR_CAT_DISPLAY),
|
||||
SettingInfo::Enum(StrId::STR_SLEEP_COVER_FILTER, &CrossPointSettings::sleepScreenCoverFilter,
|
||||
{StrId::STR_NONE_OPT, StrId::STR_FILTER_CONTRAST, StrId::STR_INVERTED},
|
||||
"sleepScreenCoverFilter", StrId::STR_CAT_DISPLAY),
|
||||
SettingInfo::Enum(StrId::STR_SEAMLESS_SLEEP, &CrossPointSettings::seamlessSleepScreen,
|
||||
{StrId::STR_NEVER, StrId::STR_AFTER_TIMEOUT, StrId::STR_ALWAYS}, "seamlessSleepScreen",
|
||||
SettingInfo::Enum(StrId::STR_QUICK_RESUME_TIMEOUT, &CrossPointSettings::quickResumeSleepScreen,
|
||||
{StrId::STR_STATE_OFF, StrId::STR_STATE_ON}, "quickResumeSleepScreen",
|
||||
StrId::STR_CAT_DISPLAY),
|
||||
SettingInfo::Enum(StrId::STR_HIDE_BATTERY, &CrossPointSettings::hideBatteryPercentage,
|
||||
{StrId::STR_NEVER, StrId::STR_IN_READER, StrId::STR_ALWAYS}, "hideBatteryPercentage",
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
void SleepActivity::onEnter() {
|
||||
Activity::onEnter();
|
||||
|
||||
const bool renderSeamless =
|
||||
SETTINGS.seamlessSleepScreen == CrossPointSettings::SEAMLESS_SLEEP_SCREEN::SEAMLESS_ALWAYS ||
|
||||
const bool renderQuickResume =
|
||||
SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::QUICK_RESUME ||
|
||||
(fromTimeout &&
|
||||
SETTINGS.seamlessSleepScreen == CrossPointSettings::SEAMLESS_SLEEP_SCREEN::SEAMLESS_AFTER_TIMEOUT);
|
||||
SETTINGS.quickResumeSleepScreen == CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT);
|
||||
|
||||
if (renderSeamless) {
|
||||
if (renderQuickResume) {
|
||||
return renderLastScreenSleepScreen();
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ void SettingsActivity::toggleCurrentSetting() {
|
||||
return;
|
||||
}
|
||||
|
||||
CrossPointSettings::normalizeDependentSettings(SETTINGS);
|
||||
SETTINGS.saveToFile();
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -243,16 +243,17 @@ void enterDeepSleep(bool fromTimeout = false) {
|
||||
HalPowerManager::Lock powerLock; // Ensure we are at normal CPU frequency for sleep preparation
|
||||
APP_STATE.lastSleepFromReader = activityManager.isReaderActivity();
|
||||
|
||||
const bool isSeamless = SETTINGS.seamlessSleepScreen == CrossPointSettings::SEAMLESS_SLEEP_SCREEN::SEAMLESS_ALWAYS ||
|
||||
(fromTimeout && SETTINGS.seamlessSleepScreen ==
|
||||
CrossPointSettings::SEAMLESS_SLEEP_SCREEN::SEAMLESS_AFTER_TIMEOUT);
|
||||
APP_STATE.showBootScreen = !isSeamless;
|
||||
const bool isQuickResumeSleep =
|
||||
SETTINGS.sleepScreen == CrossPointSettings::SLEEP_SCREEN_MODE::QUICK_RESUME ||
|
||||
(fromTimeout &&
|
||||
SETTINGS.quickResumeSleepScreen == CrossPointSettings::QUICK_RESUME_SLEEP_SCREEN::QUICK_RESUME_AFTER_TIMEOUT);
|
||||
APP_STATE.showBootScreen = !isQuickResumeSleep;
|
||||
|
||||
APP_STATE.saveToFile();
|
||||
|
||||
activityManager.goToSleep(fromTimeout);
|
||||
|
||||
if (isSeamless) {
|
||||
if (isQuickResumeSleep) {
|
||||
saveSleepFrameBuffer();
|
||||
}
|
||||
|
||||
|
||||
@@ -1274,6 +1274,7 @@ void CrossPointWebServer::handlePostSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
CrossPointSettings::normalizeDependentSettings(SETTINGS);
|
||||
SETTINGS.saveToFile();
|
||||
|
||||
LOG_DBG("WEB", "Applied %d setting(s)", applied);
|
||||
|
||||
Reference in New Issue
Block a user