From ca1178ee103a7026a79773dfb91a193cd8c747b3 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Thu, 22 Jan 2026 16:03:48 +0100 Subject: [PATCH] revert constexpr def --- src/CrossPointSettings.h | 4 +--- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CrossPointSettings.h b/src/CrossPointSettings.h index 09257a7b..8ce32a2c 100644 --- a/src/CrossPointSettings.h +++ b/src/CrossPointSettings.h @@ -54,8 +54,6 @@ 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 }; @@ -103,7 +101,7 @@ class CrossPointSettings { static CrossPointSettings& getInstance() { return instance; } uint16_t getPowerButtonDuration() const { - return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? SHORT_PRESS_DURATION_MS : LONG_PRESS_DURATION_MS; + return (shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) ? 10 : 400; } int getReaderFontId() const; diff --git a/src/main.cpp b/src/main.cpp index b81f3caa..d0c3c07f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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() <= CrossPointSettings::SHORT_PRESS_DURATION_MS) { + if (SETTINGS.shortPwrBtn == CrossPointSettings::SHORT_PWRBTN::SLEEP) { // Fast path for short press // Needed because inputManager.isPressed() may take up to ~500ms to return the correct state return;