Browse Source

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.
xmkb
Peter Johanson 3 years ago committed by Pete Johanson
parent
commit
fa110488b0
  1. 2
      app/include/zmk/events/position_state_changed.h
  2. 2
      app/src/keymap.c
  3. 2
      app/src/kscan.c

2
app/include/zmk/events/position_state_changed.h

@ -9,6 +9,8 @@
#include <zephyr.h> #include <zephyr.h>
#include <zmk/event_manager.h> #include <zmk/event_manager.h>
#define ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL UINT8_MAX
struct zmk_position_state_changed { struct zmk_position_state_changed {
uint8_t source; uint8_t source;
uint32_t position; uint32_t position;

2
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); return invoke_locally(&binding, event, pressed);
case BEHAVIOR_LOCALITY_EVENT_SOURCE: case BEHAVIOR_LOCALITY_EVENT_SOURCE:
#if ZMK_BLE_IS_CENTRAL #if ZMK_BLE_IS_CENTRAL
if (source == UINT_MAX) { if (source == ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL) {
return invoke_locally(&binding, event, pressed); return invoke_locally(&binding, event, pressed);
} else { } else {
return zmk_split_bt_invoke_behavior(source, &binding, event, pressed); return zmk_split_bt_invoke_behavior(source, &binding, event, pressed);

2
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, LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s", ev.row, ev.column, position,
(pressed ? "true" : "false")); (pressed ? "true" : "false"));
ZMK_EVENT_RAISE(new_zmk_position_state_changed( 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, .state = pressed,
.position = position, .position = position,
.timestamp = k_uptime_get()})); .timestamp = k_uptime_get()}));

Loading…
Cancel
Save