1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-24 07:28:34 +00:00

fix(core): ensure touch_get_event does not return zero after TOUCH_START

[no changelog]
This commit is contained in:
cepetr 2025-04-07 16:17:37 +02:00 committed by cepetr
parent dd2af348dc
commit a6bfe399ff

View File

@ -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;
}