feat(touch): add continuous touch polling and debug logging

This commit is contained in:
2026-02-17 23:20:42 -08:00
parent 17c44d9b08
commit 4f389ac0fe
4 changed files with 26 additions and 0 deletions

View File

@@ -21,6 +21,20 @@ void setup() {
}
void loop() {
// ── Touch debug: poll continuously ──
TouchEvent evt = display.readTouch();
if(evt.pressed) {
Serial.printf("[TOUCH] pressed: x=%d, y=%d\n", evt.x, evt.y);
} else {
// Debug: print raw Z even when not touched, to see controller state
static uint32_t lastDebug = 0;
if(millis() - lastDebug > 2000) {
lastDebug = millis();
uint16_t z = tftDriver.getRawTouchZ();
Serial.printf("[TOUCH] Raw Z=%d\n", z);
}
}
// ── State machine tick ──
logic.update();
@@ -68,4 +82,7 @@ void loop() {
if(cmd.length() > 0)
logic.onSerialCommand(cmd);
}
// Yield to WiFi/BT stack (prevents Task Watchdog timeout)
delay(10);
}