zmkfirmware / zmk

ZMK Firmware Repository
https://zmk.dev/
MIT License
2.48k stars 2.56k forks source link

Fully overlapping combos always trigger one with fewer numbers of keys #2306

Open anuvyklack opened 1 month ago

anuvyklack commented 1 month ago

I'm trying to implement bitwise input method for F1—F12 keys in ZMK using combos. Documentation claims, that

Fully overlapping combos like 0 1 and 0 1 2 are supported.

but using next code

//                          KEY POSITIONS
// ╭─────────────────────────╮          ╭─────────────────────────╮
// │ LN5 LN4 LN3 LN2 LN1 LN0 │          │ RN0 RN1 RN2 RN3 RN4 RN5 │
// │ LT5 LT4 LT3 LT2 LT1 LT0 │          │ RT0 RT1 RT2 RT3 RT4 RT5 │
// │ LM5 LM4 LM3 LM2 LM1 LM0 │ LEC  REC │ RM0 RM1 RM2 RM3 RM4 RM5 │
// │ LB5 LB4 LB3 LB2 LB1 LB0 ╰───╮  ╭───╯ RB0 RB1 RB2 RB3 RB4 RB4 │
// ╰───────╮ LH4 LH3 LH2 LH1 LH0 │  │ RH0 RH1 RH2 RH3 RH4 ╭───────╯
//         ╰─────────────────────╯  ╰─────────────────────╯

#define FN_COMBO(name, combo_bindings, keypos) \
    / { \
        combos { \
            compatible = "zmk,combos"; \
            name ## _combo { \
                timeout-ms = <500>; \
                bindings = <combo_bindings>; \
                key-positions = <keypos>; \
                layers = <FUNC>; \
            }; \
        }; \
    };

FN_COMBO(f7,  &kp F7,   LM3 LM2 LM1)
FN_COMBO(f11, &kp F11,  LM4 LM2 LM1)
FN_COMBO(f3,  &kp F3,   LM2 LM1)
FN_COMBO(f5,  &kp F5,   LM3 LM1)
FN_COMBO(f6,  &kp F6,   LM3 LM2)
FN_COMBO(f9,  &kp F9,   LM4 LM1)
FN_COMBO(f10, &kp F10,  LM4 LM2)
FN_COMBO(f12, &kp F12,  LM4 LM3)

I can't get F7 or F11 triggered. As you can see, F7 is fully overlapped with F6, and F11 with F10, and I always get F6 or F10 when press 3 keys for F7 or F11.

caksoylar commented 1 month ago

Is this all the combos you have? If not, you might be running into the combos per key limit. It works fine for me here, it might be worth trying changing the combo order to define the two key ones before the three key ones, perhaps.