Preserve touch held time across gesture detection

Touch held time was being lost when gestures were detected because the gesture detection happens before the touch release event. Now remembers the held time at the moment of gesture detection and returns it within a 250ms window, allowing UI elements to properly respond to long-press gestures. Also refactors deep sleep code to use PowerManager methods.
This commit is contained in:
Justin Mitchell
2026-06-21 01:14:40 -04:00
parent c812091a4a
commit e42503f1a4
4 changed files with 49 additions and 30 deletions
+3 -10
View File
@@ -1,5 +1,6 @@
#include <HalGPIO.h>
#include <Logging.h>
#include <PowerManager.h>
#include <Preferences.h>
#include <SPI.h>
#include <Wire.h>
@@ -272,16 +273,8 @@ void HalGPIO::startDeepSleep() {
delay(50);
inputMgr.update();
}
// Arm the wakeup trigger *after* the button is released
#if SOC_PM_SUPPORT_EXT1_WAKEUP
// Xtensa (classic ESP32 / S3): GPIO deep-sleep wake is via RTC ext1.
esp_sleep_enable_ext1_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_EXT1_WAKEUP_ALL_LOW);
#else
// RISC-V (C3): direct GPIO deep-sleep wakeup source.
esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW);
#endif
// Enter Deep Sleep
esp_deep_sleep_start();
freeink::PowerManager::armPowerButtonWakeup();
freeink::PowerManager::deepSleep();
}
void HalGPIO::verifyPowerButtonWakeup(uint16_t requiredDurationMs, bool shortPressAllowed) {