From f81e53ef85b7a6e9fb6c6fd0f5ae8a0cc4cdab15 Mon Sep 17 00:00:00 2001 From: chexit Date: Fri, 13 Nov 2026 11:59:14 +0300 Subject: [PATCH] Handle repeated center contacts in Mini 2 swipes --- station/panel.go | 6 +++++- station/panel_test.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/station/panel.go b/station/panel.go index 840c63e..867dcab 100644 --- a/station/panel.go +++ b/station/panel.go @@ -18,7 +18,7 @@ const ( panelCenter = 582 panelMinTap = 18 * time.Millisecond - panelGap = 155 * time.Millisecond + panelGap = 205 * time.Millisecond panelMaxSwipe = 520 * time.Millisecond panelHold = 500 * time.Millisecond panelRepeat = 250 * time.Millisecond @@ -144,6 +144,10 @@ func (g *panelGesture) key(now time.Time, code uint16, value uint32) { } g.invalid = now.Before(g.cooldown) } + // A moving finger can leave and re-enter the center zone while crossing it. + if g.count == 2 && code == panelCenter && g.path[1] == panelCenter { + return + } if g.held || g.count == len(g.path) { g.invalid = true return diff --git a/station/panel_test.go b/station/panel_test.go index baab02d..4fe42ee 100644 --- a/station/panel_test.go +++ b/station/panel_test.go @@ -12,6 +12,9 @@ func TestPanelSwipeAndPartialSwipeAreExclusive(t *testing.T) { }{ {[]uint16{panelMinus, panelCenter, panelPlus}, panelNext}, {[]uint16{panelPlus, panelCenter, panelMinus}, panelPrevious}, + {[]uint16{panelPlus, panelCenter, panelCenter, panelMinus}, panelPrevious}, + {[]uint16{panelMinus, panelCenter, panelCenter, panelPlus}, panelNext}, + {[]uint16{panelPlus, panelMinus}, ""}, {[]uint16{panelMinus, panelCenter}, ""}, {[]uint16{panelMinus, panelCenter, panelMinus}, ""}, {[]uint16{panelPlus}, panelLouder},