Fast wakeup (not waiting for button release)
This commit is contained in:
@@ -240,14 +240,6 @@ void HalGPIO::waitForStablePowerRelease() {
|
|||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
LOG_DBG("GPIO", "Power button stable-released after %lu ms", millis() - waitStart);
|
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() {
|
void HalGPIO::startDeepSleep() {
|
||||||
|
|||||||
@@ -124,11 +124,6 @@ EpdFont ui12RegularFont(&ubuntu_12_regular);
|
|||||||
EpdFont ui12BoldFont(&ubuntu_12_bold);
|
EpdFont ui12BoldFont(&ubuntu_12_bold);
|
||||||
EpdFontFamily ui12FontFamily(&ui12RegularFont, &ui12BoldFont);
|
EpdFontFamily ui12FontFamily(&ui12RegularFont, &ui12BoldFont);
|
||||||
|
|
||||||
void waitForPowerRelease() {
|
|
||||||
LOG_DBG("MAIN", "waitForPowerRelease: rawPin=%d", digitalRead(InputManager::POWER_BUTTON_PIN) == LOW);
|
|
||||||
gpio.waitForStablePowerRelease();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter deep sleep mode
|
// Enter deep sleep mode
|
||||||
void enterDeepSleep() {
|
void enterDeepSleep() {
|
||||||
LOG_DBG("MAIN", "enterDeepSleep called at millis=%lu, powerBtn isPressed=%d, rawPin=%d", millis(),
|
LOG_DBG("MAIN", "enterDeepSleep called at millis=%lu, powerBtn isPressed=%d, rawPin=%d", millis(),
|
||||||
@@ -265,9 +260,6 @@ void setup() {
|
|||||||
APP_STATE.saveToFile();
|
APP_STATE.saveToFile();
|
||||||
activityManager.goToReader(path);
|
activityManager.goToReader(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we're not still holding the power button before leaving setup
|
|
||||||
waitForPowerRelease();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user