From 9312e8bdb328427e4d02c103f2b3941b02610a28 Mon Sep 17 00:00:00 2001 From: Jonas Diemer Date: Fri, 2 Jan 2026 12:50:14 +0100 Subject: [PATCH] Subtract time it took reaching the evaluation from the press duration. --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b9e33426..dcfbc9b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -150,8 +150,9 @@ void verifyWakeupLongPress() { // Give the user up to 1000ms to start holding the power button, and must hold for SETTINGS.getPowerButtonDuration() const auto start = millis(); bool abort = false; - // It takes us some time to wake up from deep sleep, so we need to subtract that from the duration - constexpr uint16_t calibration = 29; + // Subtract the current time, millis() starts counting from the moment the device starts. + // This way, we remove the time we already took to reach here from the duration. + const uint16_t calibration = start; const uint16_t calibratedPressDuration = (calibration < SETTINGS.getPowerButtonDuration()) ? SETTINGS.getPowerButtonDuration() - calibration : 1;