Let a tap survive a centimetre of finger drift and log every refused tap (0.2.28)
The touch guard dropped a tap as soon as the finger drifted more than 18 px (under 3 mm) from its very first contact point, on both boards and regardless of the page-swipe setting; LVGL itself never cancelled these clicks (no scrollable ancestors, gestures do not suppress clicks). A finger that flattens or rolls while pressing was enough, and the tap vanished without a trace in the log. The limit is now about one centimetre per board (TOUCH_MOVE_LIMIT_PX: Guition 67 px, CYD 56 px), measured from a reference that settles over the first four samples; only the contact that started the touch is followed, so a second finger no longer counts as movement; the minimum contact time is per board too (TOUCH_MIN_PRESS_MS: 60 ms resistive, 20 ms capacitive). Every refused tap is logged on INFO with its reason (moved, too short, already used, bounce). Firmware 0.2.23 for CYD and Guition. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+9
-3
@@ -59,7 +59,11 @@
|
||||
############################################################
|
||||
|
||||
substitutions:
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.22"
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.23"
|
||||
# A tap survives a finger that drifts up to this far (320 px over 58 mm: 1 cm); further is a swipe.
|
||||
TOUCH_MOVE_LIMIT_PX: "56"
|
||||
# Shortest contact that counts as a tap; a resistive panel bounces, a capacitive one does not.
|
||||
TOUCH_MIN_PRESS_MS: "60"
|
||||
DYNAMIC_TILES: "true"
|
||||
DASHBOARD_INBOX_INTERNAL: "false"
|
||||
DEVICE_NAME: "cyd-new"
|
||||
@@ -785,6 +789,7 @@ esphome:
|
||||
- lambda: |-
|
||||
// Per-panel affine correction; shared defaults are neutral.
|
||||
id(ts_touch).set_raw_correction(${TOUCH_AFFINE_XX}f, ${TOUCH_AFFINE_XY}f, ${TOUCH_AFFINE_XC}f, ${TOUCH_AFFINE_YX}f, ${TOUCH_AFFINE_YY}f, ${TOUCH_AFFINE_YC}f);
|
||||
cyd::touch_guard.configure(${TOUCH_MOVE_LIMIT_PX}, ${TOUCH_MIN_PRESS_MS});
|
||||
id(last_touch_ms) = millis();
|
||||
id(display_dimmed) = false;
|
||||
lv_obj_set_style_pad_row(id(vacuum_actions), 4, 0);
|
||||
@@ -2026,14 +2031,15 @@ touchscreen:
|
||||
- lambda: |-
|
||||
id(last_touch_ms) = millis();
|
||||
id(touch_down) = true;
|
||||
cyd::touch_guard.begin(millis(), touch.x, touch.y);
|
||||
cyd::touch_guard.begin(millis(), touch.x, touch.y, touch.id);
|
||||
screen_calibration::press();
|
||||
ESP_LOGI("touch", "press native=%u,%u raw=%d,%d pressure=%d calibration=%d", touch.x, touch.y, id(ts_touch).filtered_raw_x(), id(ts_touch).filtered_raw_y(), touch.z_raw, id(calibration_active));
|
||||
on_update:
|
||||
- lambda: |-
|
||||
id(last_touch_ms) = millis();
|
||||
// Only the contact that started the touch counts; the guard ignores other ids.
|
||||
for (const auto &point : touches) {
|
||||
cyd::touch_guard.update(point.x, point.y);
|
||||
cyd::touch_guard.update(point.x, point.y, point.id);
|
||||
}
|
||||
on_release:
|
||||
- lambda: |-
|
||||
|
||||
Reference in New Issue
Block a user