From b4200162abbd4aad2934d95a5fbe120af4945f87 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Wed, 19 Jun 2024 22:01:30 +0200 Subject: [PATCH] fix(core): fix doubled touch clicks [no changelog] --- core/embed/trezorhal/stm32f4/touch/ft6x36.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/embed/trezorhal/stm32f4/touch/ft6x36.c b/core/embed/trezorhal/stm32f4/touch/ft6x36.c index eb1d18f0a..2fc78cd17 100644 --- a/core/embed/trezorhal/stm32f4/touch/ft6x36.c +++ b/core/embed/trezorhal/stm32f4/touch/ft6x36.c @@ -388,9 +388,15 @@ uint32_t touch_get_event(void) { // Finger was just pressed down event = TOUCH_START | xy; } else { - // It looks like we have missed the lift up event - // We should send the TOUCH_END event here with old coordinates - event = TOUCH_END | touch_pack_xy(driver->last_x, driver->last_y); + if ((x != driver->last_x) || (y != driver->last_y)) { + // It looks like we have missed the lift up event + // We should send the TOUCH_END event here with old coordinates + event = TOUCH_END | touch_pack_xy(driver->last_x, driver->last_y); + } else { + // We have received the same coordinates as before, + // probably this is the same start event, or a quick bounce, + // we should ignore it. + } } } else if ((nb_touches == 1) && (flags == FT6X63_EVENT_CONTACT)) { if (driver->pressed) {