Skip to content

Commit

Permalink
led_widgets fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crides committed Mar 23, 2022
1 parent 1bc6237 commit 46f571d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ config ZMK_RGB_UNDERGLOW
config ZMK_LED_WIDGETS
bool "Display widgets on top of LEDs"

if ZMK_LED_WIDGETS

config ZMK_LED_WIDGETS_MAX_WIDGET_NUM
int "Maximum number of widgets for a event type"
default 5

endif

if ZMK_RGB_UNDERGLOW

# This default value cuts down on tons of excess .conf files, if you're using GPIO, manually disable this
Expand Down
4 changes: 3 additions & 1 deletion app/src/led_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
LOG_MODULE_REGISTER(led_widgets, 4);

static const struct device *leds = DEVICE_DT_GET(DT_CHOSEN(zmk_led_widgets_dev));
extern const led_widget_t led_widgets[][4];
extern const led_widget_t led_widgets[LED_EVENT_SIZE][CONFIG_ZMK_LED_WIDGETS_MAX_WIDGET_NUM];

#define PAUSE_TIMEOUT_MS 500
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
Expand Down Expand Up @@ -159,9 +159,11 @@ static void loop_timer_handler(struct k_timer *timer) {
for (uint8_t i = 0; i < ARRAY_SIZE(led_widgets[LED_EVENT_##EV]); i ++) { \
if (match CMP led_widgets[LED_EVENT_##EV][i].arg) { \
led_widget_schedule(LED_EVENT_##EV, i); \
LOG_DBG("found %u", i); \
return ZMK_EV_EVENT_BUBBLE; \
} \
} \
LOG_DBG("not found"); \
active_widgets_ind[LED_EVENT_##EV] = -1; \
k_delayed_work_submit(&led_widget_work, K_NO_WAIT); \
return ZMK_EV_EVENT_BUBBLE; \
Expand Down

0 comments on commit 46f571d

Please sign in to comment.