From 3825dcc077d0c638a1444d5ba861997da7418c73 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 14 Oct 2026 12:51:03 +0200 Subject: [PATCH] fix(l2): fast typing - a second finger is a new tap, not a slide With two thumbs the second lands before the first lifts; the panel's first point then jumped to it and LVGL saw one press sliding from key to key, losing the first letter (or starting a scroll). A new GT911 track id is now a release, then a press. The keyboard no longer hands a rolling finger to a scroll or gesture up the tree. Co-Authored-By: Claude Opus 5.5 --- examples/companion_radio/ui-lvgl/Keyboard.h | 2 ++ examples/companion_radio/ui-lvgl/LvglPort.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/examples/companion_radio/ui-lvgl/Keyboard.h b/examples/companion_radio/ui-lvgl/Keyboard.h index be14869b..3ff828fb 100644 --- a/examples/companion_radio/ui-lvgl/Keyboard.h +++ b/examples/companion_radio/ui-lvgl/Keyboard.h @@ -279,6 +279,8 @@ static lv_obj_t* create(lv_obj_t* parent, NodePrefs* prefs) { lv_obj_add_event_cb(kbd, onLongPress, LV_EVENT_LONG_PRESSED, NULL); lv_obj_add_event_cb(kbd, onDelete, LV_EVENT_DELETE, NULL); lv_keyboard_set_popovers(kbd, true); + // A finger rolling on a key is still that key: no scroll or gesture taken up the tree + lv_obj_remove_flag(kbd, (lv_obj_flag_t)(LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_GESTURE_BUBBLE)); apply(kbd, s_script * 2); return kbd; } diff --git a/examples/companion_radio/ui-lvgl/LvglPort.h b/examples/companion_radio/ui-lvgl/LvglPort.h index a80b22de..5ced7daa 100644 --- a/examples/companion_radio/ui-lvgl/LvglPort.h +++ b/examples/companion_radio/ui-lvgl/LvglPort.h @@ -173,21 +173,35 @@ static void flushWait(lv_display_t* disp) { } #endif +// The first finger only. Typing with two thumbs, the second lands before the +// first lifts; when the first goes the point jumps to the second -- to LVGL +// one press sliding from key to key (the first key lost, or a scroll begun). +// A new finger (the panel's track id) is a release, then a press of its own. +static int16_t s_touch_id = -1; // the finger reported, -1 none static void touchCb(lv_indev_t* indev, lv_indev_data_t* data) { (void)indev; lgfx::touch_point_t tp; bool down = s_gfx->getTouch(&tp, 1) > 0; if (s_swallow) { if (!down) s_swallow = false; + s_touch_id = -1; data->state = LV_INDEV_STATE_RELEASED; return; } + if (down && s_touch_id >= 0 && tp.id != s_touch_id) { + s_touch_id = -1; + data->state = LV_INDEV_STATE_RELEASED; // at the last point; read again for the new finger + data->continue_reading = true; + return; + } if (down) { cpuSlow(false); // the frame this touch causes: at the full clock + s_touch_id = tp.id; data->state = LV_INDEV_STATE_PRESSED; data->point.x = tp.x; data->point.y = tp.y; } else { + s_touch_id = -1; data->state = LV_INDEV_STATE_RELEASED; } }