Compare commits

...

3 Commits

Author SHA1 Message Date
Xuan-Son Nguyen
beeaf99b28
Merge bab513cc95 into 3ce11f14ce 2026-01-22 12:18:07 +01:00
Xuan Son Nguyen
bab513cc95 fix clang-format 2026-01-22 12:18:00 +01:00
Xuan Son Nguyen
1867b55f52 apply suggestion 2026-01-22 11:25:20 +01:00
2 changed files with 4 additions and 2 deletions

View File

@ -54,6 +54,8 @@ class CrossPointSettings {
// Short power button press actions
enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2 };
static constexpr uint16_t SHORT_PRESS_DURATION_MS = 10;
static constexpr uint16_t LONG_PRESS_DURATION_MS = 400;
// Hide battery percentage
enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2 };
@ -101,7 +103,7 @@ class CrossPointSettings {
static CrossPointSettings& getInstance() { return instance; }
uint16_t getPowerButtonDuration() const {
return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? 10 : 400;
return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? SHORT_PRESS_DURATION_MS : LONG_PRESS_DURATION_MS;
}
int getReaderFontId() const;

View File

@ -154,7 +154,7 @@ void enterNewActivity(Activity* activity) {
// Verify power button press duration on wake-up from deep sleep
// Pre-condition: isWakeupByPowerButton() == true
void verifyPowerButtonDuration() {
if (SETTINGS.getPowerButtonDuration() <= 10) {
if (SETTINGS.getPowerButtonDuration() <= CrossPointSettings::SHORT_PRESS_DURATION_MS) {
// Fast path for short press
// Needed because inputManager.isPressed() may take up to ~500ms to return the correct state
return;