This commit is contained in:
tokazio 2023-01-17 20:56:14 +01:00
parent eb37fe9705
commit 3ff90c81a7
3 changed files with 10 additions and 1 deletions

View file

@ -164,7 +164,6 @@ static int on_macro_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_macro_driver_api = {
.binding_pressed = on_macro_binding_pressed,
.binding_released = on_macro_binding_released,
.locality = BEHAVIOR_LOCALITY_GLOBAL,
};
#define BINDING_WITH_COMMA(idx, drv_inst) ZMK_KEYMAP_EXTRACT_BINDING(idx, DT_DRV_INST(drv_inst)),

View file

@ -202,10 +202,13 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position
return err;
}
switch (locality) {
case BEHAVIOR_LOCALITY_CENTRAL:
LOG_DBG("locality is: BEHAVIOR_LOCALITY_CENTRAL");
return invoke_locally(&binding, event, pressed);
case BEHAVIOR_LOCALITY_EVENT_SOURCE:
LOG_DBG("locality is: BEHAVIOR_LOCALITY_EVENT_SOURCE");
#if ZMK_BLE_IS_CENTRAL
if (source == ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL) {
return invoke_locally(&binding, event, pressed);
@ -216,10 +219,14 @@ int zmk_keymap_apply_position_state(uint8_t source, int layer, uint32_t position
return invoke_locally(&binding, event, pressed);
#endif
case BEHAVIOR_LOCALITY_GLOBAL:
LOG_DBG("locality is: BEHAVIOR_LOCALITY_GLOBAL");
#if ZMK_BLE_IS_CENTRAL
LOG_DBG("BEHAVIOR_LOCALITY_GLOBAL is central");
for (int i = 0; i < ZMK_BLE_SPLIT_PERIPHERAL_COUNT; i++) {
zmk_split_bt_invoke_behavior(i, &binding, event, pressed);
}
#else
LOG_DBG("BEHAVIOR_LOCALITY_GLOBAL is peripheral");
#endif
return invoke_locally(&binding, event, pressed);
}

View file

@ -475,6 +475,9 @@ static int rgb_underglow_auto_state(bool *prev_state, bool new_state) {
static int rgb_underglow_event_listener(const zmk_event_t *eh) {
LOG_DBG("rgb_underglow_event_listener");
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE)
if (as_zmk_activity_state_changed(eh)) {
static bool prev_state = false;