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.

Add page turn on power button press (#286)

## Summary

* **What is the goal of this PR?**
* This PR adds a setting to (additionally) map the forward page turn
onto the powerbutton when in `EPUBReaderActivity` and powerbutton short
press is not mapped to sleep mode. I find the powerbutton to be exactly
where my thumb is while reading so it is very convenient to map the
forwardpage turn to that. Maybe Im not alone with this ^^
* **What changes are included?**

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks, specific areas to
focus on).

authored by

David Fischer and committed by
GitHub
97c48713 66811bf5

+13 -4
+8 -3
src/CrossPointSettings.h
··· 52 52 // E-ink refresh frequency (pages between full refreshes) 53 53 enum REFRESH_FREQUENCY { REFRESH_1 = 0, REFRESH_5 = 1, REFRESH_10 = 2, REFRESH_15 = 3, REFRESH_30 = 4 }; 54 54 55 + // Short power button press actions 56 + enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2 }; 57 + 55 58 // Sleep screen settings 56 59 uint8_t sleepScreen = DARK; 57 60 // Sleep screen cover mode settings ··· 61 64 // Text rendering settings 62 65 uint8_t extraParagraphSpacing = 1; 63 66 uint8_t textAntiAliasing = 1; 64 - // Duration of the power button press 65 - uint8_t shortPwrBtn = 0; 67 + // Short power button click behaviour 68 + uint8_t shortPwrBtn = IGNORE; 66 69 // EPUB reading orientation settings 67 70 // 0 = portrait (default), 1 = landscape clockwise, 2 = inverted, 3 = landscape counter-clockwise 68 71 uint8_t orientation = PORTRAIT; ··· 88 91 // Get singleton instance 89 92 static CrossPointSettings& getInstance() { return instance; } 90 93 91 - uint16_t getPowerButtonDuration() const { return shortPwrBtn ? 10 : 400; } 94 + uint16_t getPowerButtonDuration() const { 95 + return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? 10 : 400; 96 + } 92 97 int getReaderFontId() const; 93 98 94 99 bool saveToFile() const;
+2
src/activities/reader/EpubReaderActivity.cpp
··· 152 152 const bool prevReleased = mappedInput.wasReleased(MappedInputManager::Button::PageBack) || 153 153 mappedInput.wasReleased(MappedInputManager::Button::Left); 154 154 const bool nextReleased = mappedInput.wasReleased(MappedInputManager::Button::PageForward) || 155 + (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::PAGE_TURN && 156 + mappedInput.wasReleased(MappedInputManager::Button::Power)) || 155 157 mappedInput.wasReleased(MappedInputManager::Button::Right); 156 158 157 159 if (!prevReleased && !nextReleased) {
+2
src/activities/reader/XtcReaderActivity.cpp
··· 112 112 const bool prevReleased = mappedInput.wasReleased(MappedInputManager::Button::PageBack) || 113 113 mappedInput.wasReleased(MappedInputManager::Button::Left); 114 114 const bool nextReleased = mappedInput.wasReleased(MappedInputManager::Button::PageForward) || 115 + (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::PAGE_TURN && 116 + mappedInput.wasReleased(MappedInputManager::Button::Power)) || 115 117 mappedInput.wasReleased(MappedInputManager::Button::Right); 116 118 117 119 if (!prevReleased && !nextReleased) {
+1 -1
src/activities/settings/SettingsActivity.cpp
··· 21 21 SettingInfo::Enum("Status Bar", &CrossPointSettings::statusBar, {"None", "No Progress", "Full"}), 22 22 SettingInfo::Toggle("Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing), 23 23 SettingInfo::Toggle("Text Anti-Aliasing", &CrossPointSettings::textAntiAliasing), 24 - SettingInfo::Toggle("Short Power Button Click", &CrossPointSettings::shortPwrBtn), 24 + SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, {"Ignore", "Sleep", "Page Turn"}), 25 25 SettingInfo::Enum("Reading Orientation", &CrossPointSettings::orientation, 26 26 {"Portrait", "Landscape CW", "Inverted", "Landscape CCW"}), 27 27 SettingInfo::Enum("Front Button Layout", &CrossPointSettings::frontButtonLayout,