Subtract time it took reaching the evaluation from the press duration. (#208)

Adresses #206
This commit is contained in:
Jonas Diemer 2026-01-03 08:54:23 +01:00 committed by GitHub
parent 062d69dc2a
commit 5790d6f5dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,8 +150,10 @@ void verifyWakeupLongPress() {
// Give the user up to 1000ms to start holding the power button, and must hold for SETTINGS.getPowerButtonDuration() // Give the user up to 1000ms to start holding the power button, and must hold for SETTINGS.getPowerButtonDuration()
const auto start = millis(); const auto start = millis();
bool abort = false; bool abort = false;
// It takes us some time to wake up from deep sleep, so we need to subtract that from the duration // Subtract the current time, because inputManager only starts counting the HeldTime from the first update()
constexpr uint16_t calibration = 29; // This way, we remove the time we already took to reach here from the duration,
// assuming the button was held until now from millis()==0 (i.e. device start time).
const uint16_t calibration = start;
const uint16_t calibratedPressDuration = const uint16_t calibratedPressDuration =
(calibration < SETTINGS.getPowerButtonDuration()) ? SETTINGS.getPowerButtonDuration() - calibration : 1; (calibration < SETTINGS.getPowerButtonDuration()) ? SETTINGS.getPowerButtonDuration() - calibration : 1;