Commit Graph
7 Commits
Author SHA1 Message Date
Kaj Schittecat d7a0526857 Merge PR #811 (jcyrio: M9: double-tap SPACE switches the keyboard language again) 2026-11-10 11:37:47 +01:00
jcyrio a0e250cf65 test_m9_keyboard: typeWords cannot wrap, and a run of spaces gets no pause
Review follow-up: `pause - iki` is unsigned, so a pause shorter than a
keystroke would have jumped the clock forward; now it adds nothing. The
pause is also added only before a character that follows a space, not
before a second space. No caller hit either case; the cases and the
result are unchanged.

Signed-off-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
2026-11-06 06:53:19 -07:00
jcyrioandClaude Opus 5.5 f281ffa228 M9: double-tap SPACE switches the keyboard language again
On beta_100 the M9's language shortcut never fired. handleHwKey switches
when two spaces arrive within 250 ms, but the M9's same-key guard (#671)
drops a second space that arrives inside its own window, which is up to
250 ms and exactly 250 ms right after boot. Every second tap fast enough
to switch was thrown away as a bounce.

On the M9 the second tap may now come up to kM9DoubleSpaceMs (the guard's
250 ms ceiling + 200 ms) after the first. A chatter repeat of one space
still falls inside the guard's window and is dropped, so a single press
cannot switch the language. Other boards keep 250 ms.

With the longer limit, a one-letter word typed quickly (" a ") would have
counted as a double tap, because the timer only looked at the last space.
Any other key now clears it, on every board, so only two spaces in a row
switch.

test_m9_keyboard: the second space gets past the guard and within the
limit at any pace, and a chattering space types one space.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
2026-11-06 02:09:43 -07:00
jcyrioandClaude Opus 5.5 41ed89168d M9: a pause between words no longer swallows doubled letters
The same-key guard (#671) sizes its window from the typing pace, but the
pace counted every gap under 1.5 s, including the pause to think before a
word. Those pauses pushed the pace, and so the window, to the 250 ms
ceiling, and a letter doubled at the writer's real pace was dropped:
"hello all, see you soon" came out "hello al, se you son" for a 200 ms
typist who pauses ~1 s between words (on beta_100).

A gap longer than twice the pace now counts as twice the pace, so pauses
barely move it, while a writer who really slows down still raises it
within a few keys. The chatter cases from #671 are unchanged.

test_m9_keyboard: word-pause typing at 180-250 ms with 0.6-1.4 s pauses,
with and without chatter (fails on beta_100's guard), plus the pace
clamp and slow-down recovery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
2026-11-06 02:09:43 -07:00
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
Kaj SchittecatandClaude Opus 5.5 75ec6759dd test: the M9 keyboard test follows #628's one-read-per-poll driver and checks its 70 ms repeat filter
#662's test queued three keys and read them all after one poll; #628 (for #625,
keys typing twice) reads one key per poll and drops the same key again within
70 ms. The test now polls per key and also checks that a repeat inside 70 ms is
dropped and one after it is a new press. Host tests: 18 pass, 2 skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 10:34:12 +02:00
bfindlay ad13d42a12 Fix M9 keyboard detection at the V1.1 I2C address
Signed-off-by: bfindlay <bfindlay@acm.org>
2026-10-13 14:43:28 +11:00