1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-19 21:08:07 +00:00

fix(core): fix missing touch events when PRESS_DOWN is missed

[no changelog]
This commit is contained in:
tychovrahe 2024-06-22 12:01:58 +02:00 committed by TychoVrahe
parent cf69a3ca5d
commit edd5351732

View File

@ -418,12 +418,20 @@ uint32_t touch_get_event(void) {
// Finger was just lifted up
event = TOUCH_END | xy;
} else {
// 1. Most likely, we have missed the PRESS_DOWN event.
// Touch duration was too short (< 20ms) to be worth reporting.
// 2. Finger is still lifted up. Since we have already sent the
// TOUCH_END event => no event needed. This should not happen
// since two consecutive LIFT_UPs are not possible due to
// testing the interrupt line before reading the registers.
if (!starving && ((x != driver->last_x) || (y != driver->last_y))) {
// We have missed the PRESS_DOWN event.
// Report the start event only if the coordinates
// have changed and driver is not starving.
// This suggest that the previous touch was very short,
// or/and the driver is not called very frequently.
event = TOUCH_START | xy;
} else {
// Either the driver is starving or the coordinates
// have not changed, which would suggest that the TOUCH_END
// is repeated, so no event is needed -this should not happen
// since two consecutive LIFT_UPs are not possible due to
// testing the interrupt line before reading the registers.
}
}
}