A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

authored by

bdeshi and committed by
GitHub
9c11f3e4 fa2a3d25

+13 -4
+1
lib/I18n/translations/english.yaml
··· 127 127 STR_IGNORE: "Ignore" 128 128 STR_SLEEP: "Sleep" 129 129 STR_PAGE_TURN: "Page Turn" 130 + STR_FORCE_REFRESH: "Refresh Screen" 130 131 STR_PORTRAIT: "Portrait" 131 132 STR_LANDSCAPE_CW: "Landscape CW" 132 133 STR_INVERTED: "Inverted"
+1 -1
src/CrossPointSettings.h
··· 126 126 }; 127 127 128 128 // Short power button press actions 129 - enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, SHORT_PWRBTN_COUNT }; 129 + enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, FORCE_REFRESH = 3, SHORT_PWRBTN_COUNT }; 130 130 131 131 // Hide battery percentage 132 132 enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2, HIDE_BATTERY_PERCENTAGE_COUNT };
+2 -2
src/SettingsList.h
··· 71 71 SettingInfo::Toggle(StrId::STR_LONG_PRESS_SKIP, &CrossPointSettings::longPressChapterSkip, "longPressChapterSkip", 72 72 StrId::STR_CAT_CONTROLS), 73 73 SettingInfo::Enum(StrId::STR_SHORT_PWR_BTN, &CrossPointSettings::shortPwrBtn, 74 - {StrId::STR_IGNORE, StrId::STR_SLEEP, StrId::STR_PAGE_TURN}, "shortPwrBtn", 75 - StrId::STR_CAT_CONTROLS), 74 + {StrId::STR_IGNORE, StrId::STR_SLEEP, StrId::STR_PAGE_TURN, StrId::STR_FORCE_REFRESH}, 75 + "shortPwrBtn", StrId::STR_CAT_CONTROLS), 76 76 77 77 // --- System --- 78 78 SettingInfo::Enum(StrId::STR_TIME_TO_SLEEP, &CrossPointSettings::sleepTimeout,
+9 -1
src/main.cpp
··· 379 379 return; 380 380 } 381 381 382 + // Refresh screen when power button is short-pressed with FORCE_REFRESH setting. 383 + if (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::FORCE_REFRESH && 384 + mappedInputManager.wasReleased(MappedInputManager::Button::Power)) { 385 + LOG_DBG("MAIN", "Manual screen refresh triggered"); 386 + RenderLock lock; 387 + renderer.displayBuffer(HalDisplay::HALF_REFRESH); 388 + } 389 + 382 390 // Refresh the battery icon when USB is plugged or unplugged. 383 391 // Placed after sleep guards so we never queue a render that won't be processed. 384 392 if (gpio.wasUsbStateChanged()) { ··· 413 421 delay(10); 414 422 } 415 423 } 416 - } 424 + }