Integrate upstream 1626 + 1658

This commit is contained in:
jpirnay
2026-04-14 10:00:46 +02:00
parent 5c39b50eb3
commit b39c4710d2
5 changed files with 36 additions and 5 deletions
+2 -1
View File
@@ -493,4 +493,5 @@ STR_MENU_READER_LAYOUT: "Layout Settings"
STR_MENU_READER_TWEAKS: "Reader Tweaks"
STR_MENU_READER_SPACING: "Spacing"
STR_MENU_KOSYNC_SERVER: "Server Settings"
STR_MENU_KOSYNC_AUTH: "Login / Register"
STR_MENU_KOSYNC_AUTH: "Login / Register"
STR_FORCE_REFRESH: "Refresh Screen"
+1 -1
View File
@@ -128,7 +128,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, FOOTNOTES = 4, SHORT_PWRBTN_COUNT };
// Hide battery percentage
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2, HIDE_BATTERY_PERCENTAGE_COUNT };
+4 -3
View File
@@ -124,9 +124,10 @@ inline const std::vector<SettingInfo> list = {
{StrId::STR_PREV_NEXT, StrId::STR_NEXT_PREV}, "sideButtonLayout", StrId::STR_CAT_CONTROLS),
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),
SettingInfo::Enum(
StrId::STR_SHORT_PWR_BTN, &CrossPointSettings::shortPwrBtn,
{StrId::STR_IGNORE, StrId::STR_SLEEP, StrId::STR_PAGE_TURN, StrId::STR_FORCE_REFRESH, StrId::STR_FOOTNOTES},
"shortPwrBtn", StrId::STR_CAT_CONTROLS),
// --- System ---
SettingInfo::Toggle(StrId::STR_SHOW_HIDDEN_FILES, &CrossPointSettings::showHiddenFiles, "showHiddenFiles",
@@ -245,6 +245,26 @@ void EpubReaderActivity::loop() {
return;
}
const bool screenshotChordReleased = gpio.wasReleased(HalGPIO::BTN_POWER) && gpio.wasReleased(HalGPIO::BTN_DOWN);
// Handle short power button press for footnotes
if (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::FOOTNOTES &&
mappedInput.wasReleased(MappedInputManager::Button::Power) && !screenshotChordReleased) {
if (currentPageFootnotes.size() == 1) {
navigateToHref(currentPageFootnotes[0].href, true);
} else if (currentPageFootnotes.size() > 1) {
startActivityForResult(std::make_unique<EpubReaderFootnotesActivity>(renderer, mappedInput, currentPageFootnotes),
[this](const ActivityResult& result) {
if (!result.isCancelled) {
const auto& footnoteResult = std::get<FootnoteResult>(result.data);
navigateToHref(footnoteResult.href, true);
}
requestUpdate();
});
}
return;
}
auto [prevTriggered, nextTriggered] = ReaderUtils::detectPageTurn(mappedInput);
if (!prevTriggered && !nextTriggered) {
return;
+9
View File
@@ -350,6 +350,15 @@ 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);
}
if (!gpio.isPressed(HalGPIO::BTN_POWER)) {
powerHoldStart = 0;
}