mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 07:37:37 +03:00
Subtract time it took reaching the evaluation from the press duration.
This commit is contained in:
parent
062d69dc2a
commit
9312e8bdb3
@ -150,8 +150,9 @@ 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, millis() starts counting from the moment the device starts.
|
||||||
constexpr uint16_t calibration = 29;
|
// This way, we remove the time we already took to reach here from the duration.
|
||||||
|
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;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user