Fix screenshot button bleed through
This commit is contained in:
@@ -574,6 +574,7 @@ STR_BTN_ACT_PAGE_BACK_10: "Skip 10 Pages Back"
|
|||||||
STR_BTN_ACT_GO_HOME: "Go Home"
|
STR_BTN_ACT_GO_HOME: "Go Home"
|
||||||
STR_BTN_ACT_SLEEP: "Sleep"
|
STR_BTN_ACT_SLEEP: "Sleep"
|
||||||
STR_BTN_ACT_FORCE_REFRESH: "Refresh Screen"
|
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_TOC: "Open Table of Contents"
|
||||||
STR_BTN_ACT_OPEN_BOOKMARKS: "Open Bookmarks"
|
STR_BTN_ACT_OPEN_BOOKMARKS: "Open Bookmarks"
|
||||||
STR_BTN_ACT_STAR_PAGE: "Star Page"
|
STR_BTN_ACT_STAR_PAGE: "Star Page"
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ class CrossPointSettings {
|
|||||||
BTN_GO_HOME,
|
BTN_GO_HOME,
|
||||||
BTN_SLEEP,
|
BTN_SLEEP,
|
||||||
BTN_FORCE_REFRESH,
|
BTN_FORCE_REFRESH,
|
||||||
|
BTN_FORCE_FAST_REFRESH,
|
||||||
BTN_OPEN_TOC,
|
BTN_OPEN_TOC,
|
||||||
BTN_OPEN_BOOKMARKS,
|
BTN_OPEN_BOOKMARKS,
|
||||||
BTN_STAR_PAGE,
|
BTN_STAR_PAGE,
|
||||||
|
|||||||
+7
-7
@@ -141,13 +141,13 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
// All entries share the same ordered action-label list; the submenu groups them behind
|
// All entries share the same ordered action-label list; the submenu groups them behind
|
||||||
// a single placeholder row in the device UI.
|
// a single placeholder row in the device UI.
|
||||||
// Shared action options (everything except the first "default" entry).
|
// Shared action options (everything except the first "default" entry).
|
||||||
#define BTN_ACT_OPTIONS \
|
#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_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_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_FORCE_REFRESH, StrId::STR_BTN_ACT_FORCE_FAST_REFRESH, StrId::STR_BTN_ACT_OPEN_TOC, \
|
||||||
StrId::STR_BTN_ACT_STAR_PAGE, StrId::STR_BTN_ACT_FOOTNOTES, StrId::STR_BTN_ACT_NEXT_SECTION, \
|
StrId::STR_BTN_ACT_OPEN_BOOKMARKS, StrId::STR_BTN_ACT_STAR_PAGE, StrId::STR_BTN_ACT_FOOTNOTES, \
|
||||||
StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, StrId::STR_BTN_ACT_READER_MENU, \
|
StrId::STR_BTN_ACT_NEXT_SECTION, StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, \
|
||||||
StrId::STR_BTN_ACT_TOGGLE_BIONIC_READING, StrId::STR_BTN_ACT_KOREADER_SYNC
|
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
|
// 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},
|
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, {StrId::STR_BTN_DEF_EXIT_READER},
|
||||||
|
|||||||
+14
-1
@@ -337,6 +337,11 @@ void loop() {
|
|||||||
powerManager.setPowerSaving(false); // Restore normal CPU frequency on user activity
|
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;
|
static bool screenshotButtonsReleased = true;
|
||||||
if (gpio.isPressed(HalGPIO::BTN_POWER) && gpio.isPressed(HalGPIO::BTN_DOWN)) {
|
if (gpio.isPressed(HalGPIO::BTN_POWER) && gpio.isPressed(HalGPIO::BTN_DOWN)) {
|
||||||
if (screenshotButtonsReleased) {
|
if (screenshotButtonsReleased) {
|
||||||
@@ -345,6 +350,10 @@ void loop() {
|
|||||||
RenderLock lock;
|
RenderLock lock;
|
||||||
ScreenshotUtil::takeScreenshot(renderer);
|
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;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -364,7 +373,6 @@ void loop() {
|
|||||||
// (wake-up press) is never misinterpreted as a "go to sleep" press.
|
// (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.
|
// 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.
|
// 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)) {
|
if (gpio.wasPressed(HalGPIO::BTN_POWER)) {
|
||||||
powerHoldStart = millis();
|
powerHoldStart = millis();
|
||||||
LOG_DBG("MAIN", "loop: power button press detected (fresh edge)");
|
LOG_DBG("MAIN", "loop: power button press detected (fresh edge)");
|
||||||
@@ -513,6 +521,11 @@ void loop() {
|
|||||||
renderer.displayBuffer(HalDisplay::HALF_REFRESH);
|
renderer.displayBuffer(HalDisplay::HALF_REFRESH);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BA::BTN_FORCE_FAST_REFRESH: {
|
||||||
|
RenderLock lock;
|
||||||
|
renderer.displayBuffer(HalDisplay::FAST_REFRESH);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BA::BTN_OPEN_TOC:
|
case BA::BTN_OPEN_TOC:
|
||||||
activityManager.dispatchButtonAction(BA::BTN_OPEN_TOC);
|
activityManager.dispatchButtonAction(BA::BTN_OPEN_TOC);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user