mirror of
https://github.com/crosspoint-reader/crosspoint-reader.git
synced 2026-04-29 10:26:52 -07:00
feat: enable manual screen refresh on power button short press (#1626)
## Summary Adds an option to allow manual screen refresh on power button short press. ## Additional Context there's an option to refresh the screen after a set number of pages. but sometimes a manual refresh is needed to clear up stale ink pixels. this works everywhere both in and out of reading mode. resolves #550 --- ### 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? _**PARTIALLY**_, to understand the project structure.
This commit is contained in:
@@ -127,6 +127,7 @@ STR_ALWAYS: "Always"
|
||||
STR_IGNORE: "Ignore"
|
||||
STR_SLEEP: "Sleep"
|
||||
STR_PAGE_TURN: "Page Turn"
|
||||
STR_FORCE_REFRESH: "Refresh Screen"
|
||||
STR_PORTRAIT: "Portrait"
|
||||
STR_LANDSCAPE_CW: "Landscape CW"
|
||||
STR_INVERTED: "Inverted"
|
||||
|
||||
@@ -126,7 +126,7 @@ class CrossPointSettings {
|
||||
};
|
||||
|
||||
// Short power button press actions
|
||||
enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, SHORT_PWRBTN_COUNT };
|
||||
enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, FORCE_REFRESH = 3, SHORT_PWRBTN_COUNT };
|
||||
|
||||
// Hide battery percentage
|
||||
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2, HIDE_BATTERY_PERCENTAGE_COUNT };
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ inline const std::vector<SettingInfo>& getSettingsList() {
|
||||
SettingInfo::Toggle(StrId::STR_LONG_PRESS_SKIP, &CrossPointSettings::longPressChapterSkip, "longPressChapterSkip",
|
||||
StrId::STR_CAT_CONTROLS),
|
||||
SettingInfo::Enum(StrId::STR_SHORT_PWR_BTN, &CrossPointSettings::shortPwrBtn,
|
||||
{StrId::STR_IGNORE, StrId::STR_SLEEP, StrId::STR_PAGE_TURN}, "shortPwrBtn",
|
||||
StrId::STR_CAT_CONTROLS),
|
||||
{StrId::STR_IGNORE, StrId::STR_SLEEP, StrId::STR_PAGE_TURN, StrId::STR_FORCE_REFRESH},
|
||||
"shortPwrBtn", StrId::STR_CAT_CONTROLS),
|
||||
|
||||
// --- System ---
|
||||
SettingInfo::Enum(StrId::STR_TIME_TO_SLEEP, &CrossPointSettings::sleepTimeout,
|
||||
|
||||
+9
-1
@@ -379,6 +379,14 @@ void loop() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Refresh screen when power button is short-pressed with FORCE_REFRESH setting.
|
||||
if (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::FORCE_REFRESH &&
|
||||
mappedInputManager.wasReleased(MappedInputManager::Button::Power)) {
|
||||
LOG_DBG("MAIN", "Manual screen refresh triggered");
|
||||
RenderLock lock;
|
||||
renderer.displayBuffer(HalDisplay::HALF_REFRESH);
|
||||
}
|
||||
|
||||
// Refresh the battery icon when USB is plugged or unplugged.
|
||||
// Placed after sleep guards so we never queue a render that won't be processed.
|
||||
if (gpio.wasUsbStateChanged()) {
|
||||
@@ -413,4 +421,4 @@ void loop() {
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user