Commit graph

44 commits

Author SHA1 Message Date
Okke Formsma
efa497c69b fix(behaviors): Fix timing of delayed hold-tap trigger
A hold-tap timer event would be triggered too soon if the hold-tap
was delayed for longer than its tapping-term. This may cause
accidental hold behavior when the correct behavior would be tap.

By queuing the timer event instead of executing it immediately,
other delayed events get a chance to be processed properly.
2021-06-13 10:44:18 -04:00
Jonathan Rascher
4e69a32103 fix(combos): Check each combo key, not just last
The current combo completion check only makes sure the last key in the
combo is set. This works when the combo is typed correctly initially, or
when reraising events in a combo of length two. However, it fails for
longer combos since the last event in pressed_keys might be set, but the
first (or subsequent) event in pressed_keys can be NULL thanks to
release_pressed_keys.

Also added a regression test.
2021-06-08 20:35:58 -04:00
Jonathan Rascher
eecc12c980 test(combo): Add unit test for complete long combo 2021-06-08 20:35:58 -04:00
Jonathan Rascher
bba1599824 refactor(combos): Rename existing long combo test
This test doesn't test a long combo that completes, but rather one
that's incomplete (so the combo doesn't trigger). Renaming to avoid
confusion when we add more long combo tests.
2021-06-08 20:35:58 -04:00
Okke Formsma
de4979bf58 fix(behaviors): Fix sticky keys quick-release for normal keypresses
Quick release for sticky keys failed for non-layer keys. The sticky key
was released just before the key that was supposed to be modified was
handled.

The issue was caused by an error in the sticky key logic, which released
the sticky key before handling the key up event.

Fixes #696.
2021-05-09 07:52:41 -04:00
Okke Formsma
0df7110058 fix(combos): Fix stuck keys when pressing long combos.
To properly retrigger hold-taps when a combo is not activated, some
position down events are reraised instead of released. The corresponding
position up events were never reraised, causing a potential stuck key.
2021-03-11 16:23:45 -05:00
Okke Formsma
0c1940bb79 feature(hold-tap): no-hold-flash for retro taps
This is an improvement on retro-tap, solving the 'flashing hold' issue
users people experience.

When the tapping-term expires, the hold key is normally pressed. When
retro-tap is enabled, this is undesirable; only an interrupted hold-tap
should trigger the hold behavior.

This change disables the hold behavior for the 'STATUS_HOLD_TIMER'
state when retro-tap is enabled, and makes sure the
'STATUS_HOLD_INTERRUPT' state will be triggered when appropriate.
2021-02-24 07:24:27 -05:00
Okke Formsma
89ed816c67 feature(hold-tap): Retro tapping 2021-02-24 07:24:27 -05:00
Okke Formsma
9c4c266b17 refactor(hold-tap): pretty print decision_moment 2021-02-24 07:24:27 -05:00
Okke Formsma
abc60fc7cb refactor(hold-tap): split hold state into interrupt and timer 2021-02-24 07:24:27 -05:00
Okke Formsma
af9d6e9b05 style(hold-tap)!: Write hold-tap params with dashes
tapping_term_ms -> tapping-term-ms
quick_tap_ms -> quick-tap-ms

The old style works, although it's deprecated.
2021-02-10 07:55:12 -05:00
KemoNine
cd503ed17b
Feat combo layers (#661)
feat(combos): add layer filtering

Co-authored-by: KemoNine <mcrosson@kemonine.info>
2021-02-03 23:33:09 -05:00
Okke Formsma
9a7908b632 behaviors(hold-tap): Implement quick_tap_ms (TAPPING_FORCE_HOLD)
Tap-and-hold a hold-tap to hold the tap behavior so it can repeat.
After a tap, if the same key is pressed within `quick_tap_ms`, the
tap behavior is always picked.

This is useful for things like `&ht LSHFT BACKSPACE` where holding
the backspace is required.

Implements #288.
2021-02-02 15:28:16 -05:00
Okke Formsma
c925cf02dd feature(sticky_keys): add quick-release
when quick-release is enabled, the sticky key is released immediately after another key is pressed
2021-01-28 17:10:04 -05:00
Pete Johanson
7c24ab069c fix(behaviors): Updated grsec snapshots for new log format. 2021-01-25 16:11:01 -05:00
Okke Formsma
7b7701ae90 feature(modifiers): add explicit modifiers
this makes LS(LEFT_CONTROL) work as if shift and control were both
pressed explicitly. Previously, the left shift would have been released
as soon as another key was pressed. The implicit behavior is useful in
case of LS(NUMBER_1) when rolling over to other keys.

Also see #361.
2021-01-24 23:30:41 -05:00
Ally Parker
a4aaa73f06 feat: Add WPM calculator and display widget 2021-01-23 18:38:31 -05:00
Okke Formsma
5eeb310b2f feat(grave-escape): implement grave-escape
closes #85
2021-01-22 19:27:18 -05:00
Okke Formsma
feb0d5b90c feat(combos): initial implementation
closes #45
2021-01-13 21:07:41 -05:00
KemoNine
d207c3c30f
(feature) Add &to keycode/behavior (#489)
feat(behaviors): Add `&to` behavior to switch to a layer.
2020-12-29 11:57:49 -05:00
innovaker
842aa5a842 refactor: replace filename hyphens with underscores
Aligns *.h and *.c to underscore naming convention.

These were kept (with warnings) for backwards compatibility with external boards/shields:
- kscan-mock.h
- matrix-transform.h
They should be removed in the future.

PR: #523
2020-12-28 01:15:35 -05:00
Okke Formsma
6927abee6e chore(tests): remove useless &cp test 2020-12-28 00:39:53 -05:00
Okke Formsma
e00eceb508 fix(sticky keys): fix tapping-sticky-keys bug.
Sticky keys should be cleared when they were tapped in rapid succession before the timer runs out.
2020-12-06 00:33:20 -05:00
Okke Formsma
3bf770a364 bugfix(sticky keys): release active sticky keys properly
see https://github.com/zmkfirmware/zmk/issues/445
2020-11-29 20:16:51 -05:00
Okke Formsma
76a6d7b4c5 feat(sticky keys): initial implementation 2020-11-28 00:58:24 -05:00
Okke Formsma
e48a6b659c fix momentary layer bug when top layer is not &trans
Key release events released keys on the wrong layer if the 'top layer'
was not &trans above the &mo key.

base    <&mo 1>
layer 1 <&kp B>

This was caused by overwriting
`zmk_keymap_active_behavior_layer[position]` after the &mo key was
handled.
2020-11-16 17:19:27 -05:00
Pete Johanson
eff1b8223b refactor(keys): Unify usage page.
* Remove need for separate `&cp` behavior, but
  keep it for now for backward compat.
* Refactor sensor inc/dec as well.
2020-11-05 14:55:40 -05:00
innovaker
aebe90908d test: Replace superseded key names in test keymaps
Replace deprecated key names (LSFT, LCTL, RCTL, M_NEXT).

Replace abbreviated names with fully qualified names (LSFT, LCTL, LALT, LGUI, RGUI).

Follow-up to #21.
2020-11-03 23:50:54 -05:00
Okke Formsma
4f258efbf1 initial implementation for modifiers
https://github.com/zmkfirmware/zmk/issues/86
2020-11-03 00:19:37 -05:00
Okke Formsma
d38740cebf
Add timestamps to position and behavior events (#147)
* Add timestamps to position events and behaviors.

- Take original event timestamps into consideration so nested tap-holds have proper timing.
- Add position and timestamp to keycode state changed event so the one-shot behavior can properly identify other keypresses and timings.
- Add timestamp to position events received from peripheral

* reduce number of arguments to behaviors
2020-10-10 17:32:53 -04:00
Cody McGinnis
a65de800bf fix(tests): pending tests pass now 2020-09-08 12:00:46 -04:00
Okke Formsma
c5ca664411 some fixes based on feedback 2020-09-02 15:26:06 +02:00
Okke Formsma
f6a9c1ee57 rename tests 2020-09-02 15:10:46 +02:00
Okke Formsma
c33931c72c Initial implementation of hold-tap 2020-09-01 19:41:08 +02:00
Cody McGinnis
80bef160fc feat(tests): allow tests to be marked as pending
pending tests will not fail the build
2020-08-28 16:28:49 -04:00
Cody McGinnis
26414a6982 fix(docs): move testing docs to website docs 2020-08-28 16:21:31 -04:00
Cody McGinnis
4564d37477 feat(test): create simple docs for creating tests 2020-08-28 16:21:31 -04:00
Cody McGinnis
e2f77f25c8 feat(test): add testing for transparent 2020-08-28 16:21:31 -04:00
Cody McGinnis
a722cbcea3 feat(test): add tests for toggle layer 2020-08-28 16:21:31 -04:00
Cody McGinnis
3d325ccb84 feat(test): add tests for none behavior 2020-08-28 16:21:31 -04:00
Cody McGinnis
abf8b5abfa fix(test): fix normal momentary-layer test snapshot 2020-08-28 16:21:31 -04:00
Cody McGinnis
de92bf2b2d fix(test): use a smaller value for mock key intervals 2020-08-28 16:21:31 -04:00
Cody McGinnis
5f56266a69 feat(test): add tests for momentary layers 2020-08-28 16:21:31 -04:00
Cody McGinnis
f02fa01e9a fix(test): change the layout 2020-08-28 16:21:31 -04:00