diff --git a/lib/I18n/translations/english.yaml b/lib/I18n/translations/english.yaml index b741a85d0..a948ea5a8 100644 --- a/lib/I18n/translations/english.yaml +++ b/lib/I18n/translations/english.yaml @@ -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" diff --git a/src/CrossPointSettings.h b/src/CrossPointSettings.h index 9a0e298b0..43dbcba6b 100644 --- a/src/CrossPointSettings.h +++ b/src/CrossPointSettings.h @@ -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 }; diff --git a/src/SettingsList.h b/src/SettingsList.h index cdbee372c..50225c467 100644 --- a/src/SettingsList.h +++ b/src/SettingsList.h @@ -71,8 +71,8 @@ inline const std::vector& 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, diff --git a/src/main.cpp b/src/main.cpp index 5ba58cbcb..e77e8ba6f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); } } -} \ No newline at end of file +}