From a6bfe399ff3992e6a76f80ab580d5986b603d80d Mon Sep 17 00:00:00 2001 From: cepetr Date: Mon, 7 Apr 2025 16:17:37 +0200 Subject: [PATCH] fix(core): ensure touch_get_event does not return zero after TOUCH_START [no changelog] --- core/embed/io/touch/touch_fsm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/embed/io/touch/touch_fsm.c b/core/embed/io/touch/touch_fsm.c index b3d7f487c5..6f18612da4 100644 --- a/core/embed/io/touch/touch_fsm.c +++ b/core/embed/io/touch/touch_fsm.c @@ -36,8 +36,6 @@ bool touch_fsm_event_ready(touch_fsm_t* fsm, uint32_t touch_state) { } uint32_t touch_fsm_get_event(touch_fsm_t* fsm, uint32_t touch_state) { - fsm->state = touch_state; - uint32_t ticks = hal_ticks_ms(); // Test if the touch_get_event() is starving (not called frequently enough) @@ -67,9 +65,10 @@ uint32_t touch_fsm_get_event(touch_fsm_t* fsm, uint32_t touch_state) { } } else if (touch_state & TOUCH_MOVE) { if (fsm->pressed) { - if ((x != fsm->last_x) || (y != fsm->last_y)) { + if ((fsm->state & TOUCH_START) || (x != fsm->last_x) || + (y != fsm->last_y)) { // Report the move event only if the coordinates - // have changed + // have changed or previous event was TOUCH_START event = TOUCH_MOVE | xy; } } else { @@ -111,6 +110,7 @@ uint32_t touch_fsm_get_event(touch_fsm_t* fsm, uint32_t touch_state) { fsm->last_x = x; fsm->last_y = y; + fsm->state = touch_state; return event; }