diff options
author | Peter Johanson <peter@peterjohanson.com> | 2022-01-30 03:38:10 +0000 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2022-01-31 23:03:34 -0500 |
commit | fa110488b0c9e5c79066d51e0b6214447e223257 (patch) | |
tree | 734b10ff8a9c63eb1c237e1a98ca2ce4775e7d5e /app | |
parent | 4d55e60adb963b99c3be6e97c56f5c258d3c8bc5 (diff) |
fix(split): Add define for local source.
* Add `ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL` and use
it consinstently to fix bug w/ local `&reset`, `&bootloader`, etc.
Diffstat (limited to 'app')
-rw-r--r-- | app/include/zmk/events/position_state_changed.h | 2 | ||||
-rw-r--r-- | app/src/keymap.c | 2 | ||||
-rw-r--r-- | app/src/kscan.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/app/include/zmk/events/position_state_changed.h b/app/include/zmk/events/position_state_changed.h index 7685fe0..5323e94 100644 --- a/app/include/zmk/events/position_state_changed.h +++ b/app/include/zmk/events/position_state_changed.h @@ -9,6 +9,8 @@ #include <zephyr.h> #include <zmk/event_manager.h> +#define ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL UINT8_MAX + struct zmk_position_state_changed { uint8_t source; uint32_t position; diff --git a/app/src/keymap.c b/app/src/keymap.c index 8acc5ec..e586316 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -207,7 +207,7 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position return invoke_locally(&binding, event, pressed); case BEHAVIOR_LOCALITY_EVENT_SOURCE: #if ZMK_BLE_IS_CENTRAL - if (source == UINT_MAX) { + if (source == ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL) { return invoke_locally(&binding, event, pressed); } else { return zmk_split_bt_invoke_behavior(source, &binding, event, pressed); diff --git a/app/src/kscan.c b/app/src/kscan.c index 3425fab..c7cf288 100644 --- a/app/src/kscan.c +++ b/app/src/kscan.c @@ -51,7 +51,7 @@ void zmk_kscan_process_msgq(struct k_work *item) { LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position, (pressed ? "true" : "false")); ZMK_EVENT_RAISE(new_zmk_position_state_changed( - (struct zmk_position_state_changed){.source = UINT8_MAX, + (struct zmk_position_state_changed){.source = ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL, .state = pressed, .position = position, .timestamp = k_uptime_get()})); |