Commit Graph

14 Commits

Author SHA1 Message Date
Pete Johanson fc511e40cc
fix(behaviors): Fixing erroneous combo triggering, hold-taps sticking
* This is a very simple fix to a rather complicated issue. Essentially,
hold-taps will "release" (raise) their captured keys before actually
telling the event manager they have captured a key. This means the event
manager ends up assigning the `last_listener_index` to the hold-tap
subscription rather than the combo. So when the combo calls
`ZMK_EVENT_RELEASE` it raises after the hold-tap instead of after the
combo as the combo code expects.
* The corresponding test (which fails without this change) has also been added.
* An event can be captured and released in the same event handler, before
the last_listener_index would have been updated. This causes some handlers
to be triggered multiple times.
* The solution is to update the last_listener_index before calling the next
event handler, so capturing and releasing within an event handler is harmless.
* Also see discussion at https://github.com/zmkfirmware/zmk/pull/1401
* If our handler dedides our undedided hold-tap,
  return early before continuing.
* Fix incorrect pointer logic, resulting in combo
  candidate filtering leaving incorrect timeout details.

Co-authored-by: Andrew Rae <ajrae.nv@gmail.com>
Co-authored-by: okke <okke@formsma.nl>
2022-08-03 20:09:50 -04:00
Okke Formsma 8ebe0cd0c8 refactor(core): make the event manager a bit easier to read 2021-03-10 20:12:23 -05:00
Pete Johanson 3fe2acc2d1 refactor(core): Extra event payloads to own types, refactor API.
* Make it easier to use *just* event payloads by defining the data,
  and then having event manager macros generate "wrapper structs"
* Improve is_*/cast_* APIs to hide details of full event struct.
* Create `zmk_event_t` typedef to pass to event handlers.
* Bring event names inline w/ consistent `zmk_` prefix.
2021-01-20 07:06:11 -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
innovaker bac1f17cf6 refactor(app): replace Zephyr integer types with C99 integer types
u8_t → uint8_t
u16_t → uint16_t
u32_t → uint32_t
u64_t → uint64_t
s8_t → int8_t
s16_t → int16_t
s32_t → int32_t
s64_t → int64_t

Prerequisite for #223
See: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.4.0
PR: #467
2020-12-14 12:41:25 -05:00
Pete Johanson 191a2d755a chore: clang-format the codebase.
* Use the LLVM style
* Override indent width (8) and column limit (100)
* Fixes #142.
2020-09-14 00:10:34 -04:00
Pete Johanson 68e72f9275 fix: Switch to single AUTHORS file.* Closes #164 2020-09-10 10:24:23 -04:00
Okke Formsma c5ca664411 some fixes based on feedback 2020-09-02 15:26:06 +02:00
Okke Formsma c33931c72c Initial implementation of hold-tap 2020-09-01 19:41:08 +02:00
Pete Johanson cd30f440d9 Fix for the right start index for event releases. 2020-08-02 14:10:56 -04:00
Pete Johanson f548f2a87c Initial stab at mod-tap improvements.
* Not working: Roll over + mod-tap with multiple
  mod-tap bindings!
2020-07-31 00:07:16 -04:00
Pete Johanson cf8c7856ff Add the ability to capture event and release later 2020-07-30 00:13:32 -04:00
Pete Johanson a62a2f8c5c Cleanup, license headers. 2020-06-30 16:13:03 -04:00
Pete Johanson 9a991bf019 Initial event manager work, and two first events.
* Add initial event manager implementation,
  roughly mimicking Nordic's API.
* Add `position_state_changed` and
  `keycode_state_changed` events.
* Hook up HID and keymap to new events
  instead of using behaviour global event
  crazy.
2020-06-30 00:31:09 -04:00