| 226 | unsigned long HalGPIO::getPowerButtonHeldTime() const { return inputMgr.getPowerButtonHeldTime(); } |
| 227 | |
| 228 | void HalGPIO::startDeepSleep() { |
| 229 | // Ensure that the power button has been released to avoid immediately turning back on if you're holding it |
| 230 | while (inputMgr.isPressed(BTN_POWER)) { |
| 231 | delay(50); |
| 232 | inputMgr.update(); |
| 233 | } |
| 234 | // Arm the wakeup trigger *after* the button is released |
| 235 | esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW); |
| 236 | // Enter Deep Sleep |
| 237 | esp_deep_sleep_start(); |
| 238 | } |
| 239 | |
| 240 | void HalGPIO::verifyPowerButtonWakeup(uint16_t requiredDurationMs, bool shortPressAllowed) { |
| 241 | if (shortPressAllowed) { |
no test coverage detected