From 4f00ed634831c0a1b28633d65c17e028f3fd76fa Mon Sep 17 00:00:00 2001 From: jpirnay Date: Mon, 6 Apr 2026 10:07:50 +0200 Subject: [PATCH] Fast wakeup (not waiting for button release) --- lib/hal/HalGPIO.cpp | 8 -------- src/main.cpp | 8 -------- 2 files changed, 16 deletions(-) diff --git a/lib/hal/HalGPIO.cpp b/lib/hal/HalGPIO.cpp index 2904c9a4..c1734b0e 100644 --- a/lib/hal/HalGPIO.cpp +++ b/lib/hal/HalGPIO.cpp @@ -240,14 +240,6 @@ void HalGPIO::waitForStablePowerRelease() { delay(10); } LOG_DBG("GPIO", "Power button stable-released after %lu ms", millis() - waitStart); - // Flush the InputManager debounced state to match reality. - // A single update() is insufficient: if lastState was stale ("pressed"), the first - // call resets the debounce timer but cannot update currentState until a second call - // arrives after DEBOUNCE_DELAY (5 ms). Without this, isPressed() / getHeldTime() - // would carry stale values into the next loop() iteration. - inputMgr.update(); - delay(10); // > InputManager DEBOUNCE_DELAY (5 ms) - inputMgr.update(); } void HalGPIO::startDeepSleep() { diff --git a/src/main.cpp b/src/main.cpp index 4bcbc763..e601a153 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -124,11 +124,6 @@ EpdFont ui12RegularFont(&ubuntu_12_regular); EpdFont ui12BoldFont(&ubuntu_12_bold); EpdFontFamily ui12FontFamily(&ui12RegularFont, &ui12BoldFont); -void waitForPowerRelease() { - LOG_DBG("MAIN", "waitForPowerRelease: rawPin=%d", digitalRead(InputManager::POWER_BUTTON_PIN) == LOW); - gpio.waitForStablePowerRelease(); -} - // Enter deep sleep mode void enterDeepSleep() { LOG_DBG("MAIN", "enterDeepSleep called at millis=%lu, powerBtn isPressed=%d, rawPin=%d", millis(), @@ -265,9 +260,6 @@ void setup() { APP_STATE.saveToFile(); activityManager.goToReader(path); } - - // Ensure we're not still holding the power button before leaving setup - waitForPowerRelease(); } void loop() {