Skip to content

Commit

Permalink
fix(combos): Properly report combos len with emply block (zmkfirmware…
Browse files Browse the repository at this point in the history
…#2739)

Handle the scenario where there is an empty combos block and return
a zero combos length.
  • Loading branch information
petejohanson authored and caksoylar committed Jan 11, 2025
1 parent 437c5f7 commit bf8555c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/include/zmk/combos.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include <zephyr/devicetree.h>

#define ZMK_COMBOS_UTIL_ONE(n) 1
#define ZMK_COMBOS_UTIL_ONE(n) +1

#define ZMK_COMBOS_LEN \
COND_CODE_1( \
DT_HAS_COMPAT_STATUS_OKAY(zmk_combos), \
(DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_INST(0, zmk_combos), ZMK_COMBOS_UTIL_ONE, (+))), (0))
COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(zmk_combos), \
(0 DT_FOREACH_CHILD_STATUS_OKAY(DT_INST(0, zmk_combos), ZMK_COMBOS_UTIL_ONE)), \
(0))
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
};

/ {
combos {
compatible = "zmk,combos";
};

keymap {
compatible = "zmk,keymap";
label ="Default keymap";
Expand Down

0 comments on commit bf8555c

Please sign in to comment.