1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 14:08:11 +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,14 +418,22 @@ uint32_t touch_get_event(void) {
// Finger was just lifted up // Finger was just lifted up
event = TOUCH_END | xy; event = TOUCH_END | xy;
} else { } else {
// 1. Most likely, we have missed the PRESS_DOWN event. if (!starving && ((x != driver->last_x) || (y != driver->last_y))) {
// Touch duration was too short (< 20ms) to be worth reporting. // We have missed the PRESS_DOWN event.
// 2. Finger is still lifted up. Since we have already sent the // Report the start event only if the coordinates
// TOUCH_END event => no event needed. This should not happen // 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 // since two consecutive LIFT_UPs are not possible due to
// testing the interrupt line before reading the registers. // testing the interrupt line before reading the registers.
} }
} }
}
// remember the last state // remember the last state
if ((event & TOUCH_START) || (event & TOUCH_MOVE)) { if ((event & TOUCH_START) || (event & TOUCH_MOVE)) {