Skip to content

Commit

Permalink
rgbled_widget: Separate out trigger for two halves
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Oct 16, 2023
1 parent 8821e3c commit 7a4fce3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/boards/shields/rgbled_widget/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ ZMK_SUBSCRIPTION(led_battery_listener, zmk_battery_state_changed);

static int led_position_listener_cb(const zmk_event_t *eh) {
const struct zmk_position_state_changed *ev = as_zmk_position_state_changed(eh);
if (!ev) {
if (!ev || ev->source != ZMK_POSITION_STATE_CHANGE_SOURCE_LOCAL) {
return ZMK_EV_EVENT_BUBBLE;
}

static uint8_t combo_state = 0;

if (ev->state &&
((combo_state == 0 && ev->position == 6) || (combo_state == 1 && ev->position == 5))) {
(((combo_state == 0 && ev->position == 6) || (combo_state == 1 && ev->position == 5)) ||
((combo_state == 0 && ev->position == 3) || (combo_state == 1 && ev->position == 4)))) {
combo_state++;
} else {
combo_state = 0;
Expand Down

0 comments on commit 7a4fce3

Please sign in to comment.