From fa110488b0c9e5c79066d51e0b6214447e223257 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Sun, 30 Jan 2022 03:38:10 +0000 Subject: 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. --- app/include/zmk/events/position_state_changed.h | 2 ++ app/src/keymap.c | 2 +- app/src/kscan.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app') 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 #include +#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()})); -- cgit v1.2.3