Fix screenshot button bleed through

This commit is contained in:
jpirnay
2026-05-01 16:07:48 +02:00
parent 1c28fe8d8a
commit fd111fbf98
4 changed files with 24 additions and 9 deletions
+2 -1
View File
@@ -574,6 +574,7 @@ STR_BTN_ACT_PAGE_BACK_10: "Skip 10 Pages Back"
STR_BTN_ACT_GO_HOME: "Go Home"
STR_BTN_ACT_SLEEP: "Sleep"
STR_BTN_ACT_FORCE_REFRESH: "Refresh Screen"
STR_BTN_ACT_FORCE_FAST_REFRESH: "Fast Refresh Screen"
STR_BTN_ACT_OPEN_TOC: "Open Table of Contents"
STR_BTN_ACT_OPEN_BOOKMARKS: "Open Bookmarks"
STR_BTN_ACT_STAR_PAGE: "Star Page"
@@ -599,4 +600,4 @@ STR_KB_HINT_UPPER_SECONDARY: "Hold SELECT for UPPERCASE or secondary char"
STR_KB_HINT_LOWER_SECONDARY: "Hold SELECT for lowercase or secondary char"
STR_KB_HINT_URL_SNIPPETS: "Press URL for snippets"
STR_BIONIC_READING: "Bionic Reading"
STR_BTN_ACT_TOGGLE_BIONIC_READING: "Toggle Bionic Reading"
STR_BTN_ACT_TOGGLE_BIONIC_READING: "Toggle Bionic Reading"
+1
View File
@@ -278,6 +278,7 @@ class CrossPointSettings {
BTN_GO_HOME,
BTN_SLEEP,
BTN_FORCE_REFRESH,
BTN_FORCE_FAST_REFRESH,
BTN_OPEN_TOC,
BTN_OPEN_BOOKMARKS,
BTN_STAR_PAGE,
+7 -7
View File
@@ -141,13 +141,13 @@ inline const std::vector<SettingInfo> list = {
// All entries share the same ordered action-label list; the submenu groups them behind
// a single placeholder row in the device UI.
// Shared action options (everything except the first "default" entry).
#define BTN_ACT_OPTIONS \
StrId::STR_BTN_ACT_PAGE_FORWARD, StrId::STR_BTN_ACT_PAGE_BACK, StrId::STR_BTN_ACT_PAGE_FORWARD_10, \
StrId::STR_BTN_ACT_PAGE_BACK_10, StrId::STR_BTN_ACT_GO_HOME, StrId::STR_BTN_ACT_SLEEP, \
StrId::STR_BTN_ACT_FORCE_REFRESH, StrId::STR_BTN_ACT_OPEN_TOC, StrId::STR_BTN_ACT_OPEN_BOOKMARKS, \
StrId::STR_BTN_ACT_STAR_PAGE, StrId::STR_BTN_ACT_FOOTNOTES, StrId::STR_BTN_ACT_NEXT_SECTION, \
StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, StrId::STR_BTN_ACT_READER_MENU, \
StrId::STR_BTN_ACT_TOGGLE_BIONIC_READING, StrId::STR_BTN_ACT_KOREADER_SYNC
#define BTN_ACT_OPTIONS \
StrId::STR_BTN_ACT_PAGE_FORWARD, StrId::STR_BTN_ACT_PAGE_BACK, StrId::STR_BTN_ACT_PAGE_FORWARD_10, \
StrId::STR_BTN_ACT_PAGE_BACK_10, StrId::STR_BTN_ACT_GO_HOME, StrId::STR_BTN_ACT_SLEEP, \
StrId::STR_BTN_ACT_FORCE_REFRESH, StrId::STR_BTN_ACT_FORCE_FAST_REFRESH, StrId::STR_BTN_ACT_OPEN_TOC, \
StrId::STR_BTN_ACT_OPEN_BOOKMARKS, StrId::STR_BTN_ACT_STAR_PAGE, StrId::STR_BTN_ACT_FOOTNOTES, \
StrId::STR_BTN_ACT_NEXT_SECTION, StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, \
StrId::STR_BTN_ACT_READER_MENU, StrId::STR_BTN_ACT_TOGGLE_BIONIC_READING, StrId::STR_BTN_ACT_KOREADER_SYNC
// Back button: short=exit reader, double=ignore, long=go home
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, {StrId::STR_BTN_DEF_EXIT_READER},
+14 -1
View File
@@ -337,6 +337,11 @@ void loop() {
powerManager.setPowerSaving(false); // Restore normal CPU frequency on user activity
}
// Power-hold timer for sleep. Hoisted above the screenshot block so the
// screenshot path can clear it and avoid a stale POWER press triggering sleep
// after the screenshot completes.
static unsigned long powerHoldStart = 0;
static bool screenshotButtonsReleased = true;
if (gpio.isPressed(HalGPIO::BTN_POWER) && gpio.isPressed(HalGPIO::BTN_DOWN)) {
if (screenshotButtonsReleased) {
@@ -345,6 +350,10 @@ void loop() {
RenderLock lock;
ScreenshotUtil::takeScreenshot(renderer);
}
// Discard the POWER+DOWN presses so they don't fire Short/Long events
// (e.g. page turn, sleep) once the user releases the combo.
buttonEventManager.drain();
powerHoldStart = 0;
}
return;
} else {
@@ -364,7 +373,6 @@ void loop() {
// (wake-up press) is never misinterpreted as a "go to sleep" press.
// The power button long-press is not user-remappable, so this path always owns it.
// Sleep mapped to other buttons is handled by the dispatcher's BTN_SLEEP case below.
static unsigned long powerHoldStart = 0;
if (gpio.wasPressed(HalGPIO::BTN_POWER)) {
powerHoldStart = millis();
LOG_DBG("MAIN", "loop: power button press detected (fresh edge)");
@@ -513,6 +521,11 @@ void loop() {
renderer.displayBuffer(HalDisplay::HALF_REFRESH);
break;
}
case BA::BTN_FORCE_FAST_REFRESH: {
RenderLock lock;
renderer.displayBuffer(HalDisplay::FAST_REFRESH);
break;
}
case BA::BTN_OPEN_TOC:
activityManager.dispatchButtonAction(BA::BTN_OPEN_TOC);
break;