-
-
Notifications
You must be signed in to change notification settings - Fork 39.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process combos earlier & overlapping combos #8591
Conversation
Just realized I didn't test this with the default COMBO_TERM (TAPPING_TERM). Most likely something is not going to work as supposed to. |
Huh, nothing broke with default |
Moving the processing to keyboard.c wasn't actually useful at all. But I got Action Combos working!! Not sure if it's actually a good implementation but seems to work fine. Also it might be completely useless because of |
There might be a bug somewhere. My combos get disabled completely sometimes and I have to re-plug the keyboard to get them back working. Edit: Just I posted this something new happens... They do sometimes come back without resetting. Edit 2: Okay. Pressing a LayerTap key and a combo key fast is the problem. While the LT is still waiting for the end of TAPPING_TERM or an interrupting key, the combo key from layer 1 is registered as a combo key down. Then the LT kicks in and the combo key from layer 1 is never unregistered as the key released is now a key from layer 2. |
@germ since you use the combo feature extensively, would you mind taking a look and maybe testing this, if you have the time? |
I don't have time to fix the bug, but I have verified that it exists. @sevanteri My combos get disabled due to that bug. When you have a fix give me a tag and I'll give it a test on my GergoPlex/Ginny builds! 😄 |
@germ I thought the latest commit should have fixed it. But if not, I'll get back to you. :P |
Solid. I just pulled down the most recent a few minutes before that comment. #8262 has the gergoplex keymaps in it (which use combos heavily) if that can help you track down what's messing it up :) |
I honestly can't reproduce the bug with the latest commit. I took a peek at your Gergoplex config, @germ, and all I got from it that you don't use permissive hold or ignore mod tap interrupts. I tried playing around with those options but neither really affect the bug. I also tried changing combo term, yet again without effect. |
Hmmm... got some completely different bug now. Again with a LayerTap key and a combo key. Now the key behind the layer got stuck and started repeating and after that the whole keyboard was stuck until I pressed the LayerTap+combokey again. Some sort of timing thing again. |
Trying to fix the latest bug, I just found that it only happens on my Ergodox Infinity but not on my Gergo... AND the only keys I got the bug to appear was Play, VolUp and VolDown, all in the same column, behind one layer. None of the other keys behind the layer were bugged. |
Okay the Ergodox bug is not related to combos in any way. It happens with combos disabled. |
@germ could you test with the latest commit. I haven't had stuck combos for a while but I did encounter stuck mods from ModTaps that were also part of chords. I also played around with mods from combos and pressing combos when the mod combo is pressed. Currently pressing other combos don't work correctly. The timer is not reset accordingly because there are combo keys still being held. |
Sure, I'llgive it a shot later tonight |
I'll clarify my earlier comment about stuck modifiers: I did also fix it... I did mention it in the commit message but I should have included that in the previous comment too. |
Still found some weird behaviors here. Usually it does not matter which key you hit first in the combo. When I'm using the LT()s within the combo in combination with basic KC_ keys however, I need to hit the LT() slightly before the KC_ keys. Every time I hit the KC_ key before the LT() I simply get the output of the KC_ key and the combo is ignored. |
@cari66ean Did you remember to define But... maybe that is a bug too. Even though I've also been thinking about if this would need its own name instead of the old |
@sevanteri weird, I had COMBO_ALLOW_ACTION_KEYS defined. I thought I had to have it defined for keys like LT() to even work in combos?! |
@cari66ean Ok, if it was defined then there really is a bug somewhere... Maybe I'll just start looking how to make tests for this next. |
I've been using my Ergodox Infinity and my Gergo with this branch for a while now and I have not encountered any bugs. Could someone else come and test this too? @cari66ean The bug you described is exactly how QMK behaves on the master branch and I can't reproduce it with this branch. Are you sure you merged this branch? (Sorry, not trying to be rude, just genuinely wondering...) @germ Have you had time testing this? If yes, have you encountered any issues? |
Sorry, I've been busy attempting to get overlapping combos working. It's a mess and I'm on my third rewrite at the moment. It's over in germ/qmk_firmware/overlapping-combos (go one commit back, I reverted). If you're looking for some combo shenanigans to hack on, could you try hacking on that? Once that's clear having a few hundred combos on a board is possible. Right now given combos ASD and AS, if ASD is stroked both fire. :( |
Glad to see this on track to be merged in! Maybe I can get my boards moved over to master now 😅 |
@tzarc thank you for the heads-up. Although I'm sorry to hear the news, I understand the technical limitation of Microchip ATtiny85 and the benefits this PR creates for QMK in long term. In the coming days I will update the user's guide of ANAVI Macro Pad 2 to point out particular QMK versions (commits) where it is still supported. Thanks, Leon |
@tzarc @leon-anavi I wonder if defining EDIT: Tried it out, no dice :( |
We're more than happy to tag a known-good revision on your behalf, FWIW. If there's the possibillty of reintegrating the board, great! However when I looked at what was compiled in, there wasn't a lot that looked promising:
When I checked, we'd need to find 600-odd bytes of stuff to remove... perhaps some aggressive tuning could be done to get it to fit but I'm not sure that'd be much use once the next PR from someone gets made. :( |
Fixed some issues with |
Does this currently work (home-row mods+combos)? I am trying here, but can't seem to get it to work (combos are ignored if overlapped with ModTap). Any help would be greatly appreciated. |
Your combos aren't written correctly :) Your keymap says: Your combo says: It needs to say: |
Thank you soooo much! I thought about this a couple of times, but couldn't figure out how to correctly write it from the docs. |
* Combo processing improvements. Now it is possible to use ModTap and LayerTap keys as part of combos. Overlapping combos also don't trigger all the combos, just exactly the one that you press. New settings: - COMBO_MUST_HOLD_MODS - COMBO_MOD_TERM - COMBO_TERM_PER_COMBO - COMBO_MUST_HOLD_PER_COMBO - COMBO_STRICT_TIMER - COMBO_NO_TIMER * Remove the size flags from combo_t struct boolean members. This in the end actually saves space as the members are accessed so many times. The amount of operations needed to access the bits uses more memory than setting the size saves. * Fix `process_combo_key_release` not called correctly with tap-only combos * Fix not passing a pointer when NO_ACTION_TAPPING is defined. * Docs for `COMBO_ONLY_FROM_LAYER` * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update quantum/process_keycode/process_combo.c Co-authored-by: precondition <[email protected]> * Add `EXTRA_SHORT_COMBOS` option. Stuff combo's `disabled` and `active` flags into `state`. Possibly can save some space. * Add more examples and clarify things with dict management system. - Simple examples now has a combo that has modifiers included. - The slightly more advanced examples now are actually more advanced instead of just `tap_code16(<modded-keycode>)`. - Added a note that `COMBO_ACTION`s are not needed anymore as you can just use custom keycodes. - Added a note that the `g/keymap_combo.h` macros use the `process_combo_event` function and that it is not usable in one's keymap afterwards. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Change "the" combo action example to "email" example. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Fix sneaky infinite loop with `combo_disable()` No need to call `dump_key_buffer` when disabling combos because the buffer is either being dumped if a combo-key was pressed, or the buffer is empty if a non-combo-key is pressed. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> Co-authored-by: precondition <[email protected]> Co-authored-by: Drashna Jaelre <[email protected]>
Note, changes came from: - qmk/qmk_firmware#8591 - qmk/qmk_firmware#12697 - qmk/qmk_firmware#12949
Note, changes came from: - qmk/qmk_firmware#8591 - qmk/qmk_firmware#12697 - qmk/qmk_firmware#12949
Note, changes came from: - qmk/qmk_firmware#8591 - qmk/qmk_firmware#12697 - qmk/qmk_firmware#12949
WARNING: Needs qmk#8591 to work properly.
… and add COMBO_ONLY_FROM_LAYER
* Combo processing improvements. Now it is possible to use ModTap and LayerTap keys as part of combos. Overlapping combos also don't trigger all the combos, just exactly the one that you press. New settings: - COMBO_MUST_HOLD_MODS - COMBO_MOD_TERM - COMBO_TERM_PER_COMBO - COMBO_MUST_HOLD_PER_COMBO - COMBO_STRICT_TIMER - COMBO_NO_TIMER * Remove the size flags from combo_t struct boolean members. This in the end actually saves space as the members are accessed so many times. The amount of operations needed to access the bits uses more memory than setting the size saves. * Fix `process_combo_key_release` not called correctly with tap-only combos * Fix not passing a pointer when NO_ACTION_TAPPING is defined. * Docs for `COMBO_ONLY_FROM_LAYER` * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update quantum/process_keycode/process_combo.c Co-authored-by: precondition <[email protected]> * Add `EXTRA_SHORT_COMBOS` option. Stuff combo's `disabled` and `active` flags into `state`. Possibly can save some space. * Add more examples and clarify things with dict management system. - Simple examples now has a combo that has modifiers included. - The slightly more advanced examples now are actually more advanced instead of just `tap_code16(<modded-keycode>)`. - Added a note that `COMBO_ACTION`s are not needed anymore as you can just use custom keycodes. - Added a note that the `g/keymap_combo.h` macros use the `process_combo_event` function and that it is not usable in one's keymap afterwards. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Change "the" combo action example to "email" example. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Fix sneaky infinite loop with `combo_disable()` No need to call `dump_key_buffer` when disabling combos because the buffer is either being dumped if a combo-key was pressed, or the buffer is empty if a non-combo-key is pressed. * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> * Update docs/feature_combo.md Co-authored-by: precondition <[email protected]> Co-authored-by: precondition <[email protected]> Co-authored-by: Drashna Jaelre <[email protected]>
General Combo improvements.
Description
These changes move Combo processing before TMK's tapping. Before Combos were not really usable with ModTaps (#8003) because the tapping code was interfering and made both the Combo and ModTap unusable.
Combos now don't fire immediately when a complete combo is detected. Instead the whole
COMBO_TERM
(now defaults to 50) is now waited. This allows overlapping chords to be defined. So it is now possible to define combos that have keys that overlap with other combos and have only one of the combos trigger. For example a combo with keys A and B, and a combo with keys A, B and C. Before this PR both combos would trigger when all three keys are pressed, now only the latter combo triggers.This PR also enables advanced keycodes as the result of a combo. Before only basic keycodes could be used. Now you can have Mod-Taps, Layer-Taps, One Shot Modifiers,
RESET
and many others.There are also new options for setting COMBO_TERM per combo, and combos resulting to modifiers needing to be held for the whole COMBO_TERM (little reasons to just tap modifiers), and some other, more advanced options too. Check the docs if your interested.
This PR possibly would help with #8212 and definitely would solve #8003.
Types of Changes
Issues Fixed or Closed by This PR
Checklist