If a non-Topsy key toggles on, disable repeating the Topsy one

This is to avoid the case where chording a Topsy and a non-Topsy key would
result in both being repeated very fast. This happened because each cycle we
sent two reports: one for the Topsy key, one for the others. This didn't allow
the host's normal repeating behaviour to kick in, and instead, resulted in both
keys being input very fast.

Fixes #5.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent 8a426cc3e3
commit 209a92b6e0

@ -34,9 +34,13 @@ EventHandlerResult TopsyTurvy::onKeyswitchEvent(Key &mapped_key, byte row, byte
if (mapped_key.raw == Key_RightShift.raw)
bitWrite(mod_state_, 1, keyIsPressed(key_state));
if (mapped_key < ranges::TT_FIRST || mapped_key > ranges::TT_LAST) {
if (keyToggledOn(key_state)) {
last_pressed_position_ = row * COLS + col;
}
if (mapped_key < ranges::TT_FIRST || mapped_key > ranges::TT_LAST)
return EventHandlerResult::OK;
}
if (keyToggledOn(key_state)) {
last_pressed_position_ = row * COLS + col;

Loading…
Cancel
Save