From 4f4d55e7c9ed86cc789e65629f84d73fbab03ea1 Mon Sep 17 00:00:00 2001 From: mverch67 Date: Sun, 1 Jun 2025 10:04:44 +0200 Subject: [PATCH] fix touchscreen --- .../extra_variants/t_deck_pro/variant.cpp | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/platform/extra_variants/t_deck_pro/variant.cpp b/src/platform/extra_variants/t_deck_pro/variant.cpp index 026e703af..eae9335ce 100644 --- a/src/platform/extra_variants/t_deck_pro/variant.cpp +++ b/src/platform/extra_variants/t_deck_pro/variant.cpp @@ -8,28 +8,12 @@ CSE_CST328 tsPanel = CSE_CST328(EINK_WIDTH, EINK_HEIGHT, &Wire, CST328_PIN_RST, CST328_PIN_INT); -volatile bool intReceived = false; - -void touchISR() -{ - // Detach the interrupt to prevent multiple interrupts - detachInterrupt(digitalPinToInterrupt(CST328_PIN_INT)); - intReceived = true; -} - bool readTouch(int16_t *x, int16_t *y) { - if (intReceived) { - intReceived = false; - // Reattach the interrupt for the next touch - attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING); - - // Read the touch point - if (tsPanel.isTouched(0)) { - *x = tsPanel.getPoint(0).x; - *y = tsPanel.getPoint(0).y; - return true; - } + if (tsPanel.getTouches()) { + *x = tsPanel.getPoint(0).x; + *y = tsPanel.getPoint(0).y; + return true; } return false; } @@ -38,7 +22,6 @@ bool readTouch(int16_t *x, int16_t *y) void lateInitVariant() { tsPanel.begin(); - attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING); touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch); touchScreenImpl1->init(); }