From 98e1c1a61478e92d5fa411760320f4a4353a2bf4 Mon Sep 17 00:00:00 2001 From: "openai-code-agent[bot]" <242516109+Codex@users.noreply.github.com> Date: Sun, 1 Mar 2026 07:30:15 +0000 Subject: [PATCH 1/2] Initial plan From 912bafff2fa5288e098d8d7cada9fd5e1b45ac81 Mon Sep 17 00:00:00 2001 From: "openai-code-agent[bot]" <242516109+Codex@users.noreply.github.com> Date: Sun, 1 Mar 2026 07:32:56 +0000 Subject: [PATCH 2/2] fix: calibrate touch detection width dynamically --- display_rotator.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/display_rotator.py b/display_rotator.py index b15e3ef..a7427f0 100644 --- a/display_rotator.py +++ b/display_rotator.py @@ -356,17 +356,20 @@ def touch_worker(cmd_q: "queue.Queue[str]", stop_evt: threading.Event, touch_wid print(f"[rotator] Touch controls listening on {device} (width {device_touch_width})", flush=True) last_x = device_touch_min + (device_touch_width // 2) + min_seen = device_touch_min + max_seen = device_touch_min + device_touch_width - 1 touch_down = False last_tap_ts = None last_emit = 0.0 def emit_tap(tap_x: int, now: float) -> None: nonlocal last_tap_ts, last_emit - relative_x = tap_x - device_touch_min + width = max(2, max_seen - min_seen + 1) + relative_x = tap_x - min_seen if relative_x < 0: relative_x = 0 - elif relative_x >= device_touch_width: - relative_x = device_touch_width - 1 + elif relative_x >= width: + relative_x = width - 1 if last_tap_ts is not None and (now - last_tap_ts) <= DOUBLE_TAP_WINDOW_SECS: if (now - last_emit) >= tap_debounce_secs: @@ -395,6 +398,10 @@ def emit_tap(tap_x: int, now: float) -> None: if ev_type == EV_ABS and ev_code in (ABS_X, ABS_MT_POSITION_X): last_x = ev_value + if ev_value < min_seen: + min_seen = ev_value + if ev_value > max_seen: + max_seen = ev_value elif ev_type == EV_KEY and ev_code == BTN_TOUCH: if ev_value == 1: touch_down = True