Files
wadamesh/variants/thinknode_m9
Kaj SchittecatandClaude Opus 5.5 da25babc51 M9: a slow key press that chatters on the way up types once (#671)
The keyboard controller (Elecrow's ThinkNode-M9-KB firmware on the S2)
scans the matrix every 10 ms with no debounce on the matrix keys and
latches a key byte on every released-to-pressed edge, letters on the press
itself. A contact that chatters as a slow key comes up is a second edge, so
the same byte arrives again about one hold time after the first: 100 to
250 ms on a deliberate press. #628's 70 ms same-key guard caught the stale
latch and a bounce on the way down, not this, which is why it was worse
when typing slowly.

The controller has no key-state register, so the host cannot see the key
go up; the guard goes by time, now in a pure M9KeyGuard.h:

- The same printable character again within the window is the same press.
  The window is three fifths of the usual gap between two different
  characters (the typing pace), 70 to 250 ms. A chatter repeat comes after
  about one hold, a letter typed twice on purpose after a whole keystroke.
- Arrows, Delete, Enter and the function keys keep 70 ms, so quick taps
  down a list and a held Delete's 100 ms repeat still get through.

test_m9_keyboard simulates the controller's scan and latch at 1 ms
resolution: with #628's rule a slow "hello" with release chatter types
"hheelllloo"; with the guard it types "hello", and "bookkeeper" keeps its
doubles at slow and fast pace. A key held past 250 ms that then chatters
still doubles, and the test says so: only the controller could fix that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 13:34:50 +01:00
..