-
-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
Custom Tapping Term per key #5009
Conversation
// tmk_core/common/keyboard.h
typedef struct {
keypos_t key;
bool pressed;
uint16_t time;
} keyevent_t; I see someone else has gone down this path before, using EDIT: Whoops, this is pretty much the same code from the linked issue... |
In theory, that's all we need. qmk_firmware/quantum/keymap_common.c Lines 209 to 213 in 3c0c432
In, fact, all we really need is the keypos_t structure. We could skip everything else. But it doesn't seem to work properly. |
This probably isn't related, but I noticed qmk_firmware/tmk_core/common/action_layer.h Line 100 in 1d49f76
Presumably everywhere else is uint8_t, so I doubt this is the root cause. |
Yeah, there are a number of cases where this is the case. But yeah, is shouldn't matter. Feel free to correct it though. :) |
Hm. Another thought: should |
I've tried: uint16_t get_tapping_term(keyevent_t event) {
switch (keymap_key_to_keycode(layer_switch_get_layer(event.key), event.key)) { and uint16_t get_tapping_term(keyevent_t* event) {
switch (keymap_key_to_keycode(layer_switch_get_layer(event->key), event->key)) { And the correct versions of the define. Neither way works. I know the code change itself works, since, if you change the default, it absolutely has an affect. But .... it's some issue with detecting the keycodes. |
qmk_firmware/tmk_core/common/action_tapping.c Lines 89 to 91 in c2080d3
I notice that
|
Tried that, doesn't make a difference. z #define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term((e))) |
Okay, I added some debugging to it, and it looks like the issue is that the column and row are not being outputted correctly. xprintf("get_tapping_term (main): ");
xprintf("col: %i, row: %\n", event.key.col, event.key.row); is outputting
Which means that it's not getting a valid structure at the time that this is occurring. :( |
Is that xprintf truncated for brevity? Cause that does not look right... |
It was bad editing :D But yeah, looks like if I want to fix this, I'll have to convert |
qmk_firmware/tmk_core/common/keyboard.h Line 43 in c2080d3
Sorry I can't be of more help right now, I don't have a QMK board in front of me... |
Even changing the funky parenthesis stuff didn't affect anything. Using a pointer or not didn't make a difference. Basically, it's not passing on the information correctly, from what I can tell |
Actually nope, it requires event.time. |
Got it! |
@fauxpark I tested it, and then to confirm, I dug and dug. The issue is that "e" is actually "TICK". Which is this: qmk_firmware/tmk_core/common/keyboard.h Lines 54 to 58 in 9f63cd0
This is why I was seeing 255 for both the row and column, above. Thank you for trying to help. At the very lest, it kept me digging into this, for a proper solution. And it was found, so yay! |
Now, I have to figure out this: Specifically, I need to replace But I'm .... done for today. Tomorrow's drashna gets to worry about that |
Argh, I saw that and didn't even register it! 😆 Looks like the chain goes from all the way up in |
LOL, yeah. But hey, i learned some more QMK, so it's all worth it! |
I lied, tomorrow's drashna is off the hook. Changed one of the functions to check if the tapping term is 500ms or greater (based on the keycode, not the define) |
Co-Authored-By: drashna <drashna@live.com>
Since we can't be sure that tapping term is actually 500
Clean up function so that users don't need to call the event function, and instead only check the keycode
f932771
to
45d6d25
Compare
👍 from me on the docs! |
Thanks :) |
* Add customizable tapping terms * Add Documentation * Fix function * Fixes * It's not a pointer * Add debugging output * Update documentation to be at least vaguely accurate * Use `get_tapping_term(tapping_key.event)` instead `e` doesn't include column and row information, properly. It registers as 255, regardless of the actual keypress. However `tapping_key.event` actually gives the correct column and row information. It appears be the correct structure to use. In fact, it looks like the issue is that `e` is actually the "TICK" structure, as defined in keyboard.h * Use variable tapping term value rather than define * Silly drashna - tapping_key.event, not event * add get_event_keycode() function * Fix typo Co-Authored-By: drashna <drashna@live.com> * Remove post_process_record_quantum since it's the wrong PR * Update quantum/quantum.c Co-Authored-By: drashna <drashna@live.com> * Better handle ifdef statement for permissive hold Since we can't be sure that tapping term is actually 500 * Update quantum.c comments based on feedback * Clean up get_tapping_term function Clean up function so that users don't need to call the event function, and instead only check the keycode * Add ability to run functionality on and off * Make ifdef's more compact
* Add customizable tapping terms * Add Documentation * Fix function * Fixes * It's not a pointer * Add debugging output * Update documentation to be at least vaguely accurate * Use `get_tapping_term(tapping_key.event)` instead `e` doesn't include column and row information, properly. It registers as 255, regardless of the actual keypress. However `tapping_key.event` actually gives the correct column and row information. It appears be the correct structure to use. In fact, it looks like the issue is that `e` is actually the "TICK" structure, as defined in keyboard.h * Use variable tapping term value rather than define * Silly drashna - tapping_key.event, not event * add get_event_keycode() function * Fix typo Co-Authored-By: drashna <drashna@live.com> * Remove post_process_record_quantum since it's the wrong PR * Update quantum/quantum.c Co-Authored-By: drashna <drashna@live.com> * Better handle ifdef statement for permissive hold Since we can't be sure that tapping term is actually 500 * Update quantum.c comments based on feedback * Clean up get_tapping_term function Clean up function so that users don't need to call the event function, and instead only check the keycode * Add ability to run functionality on and off * Make ifdef's more compact
* Add customizable tapping terms * Add Documentation * Fix function * Fixes * It's not a pointer * Add debugging output * Update documentation to be at least vaguely accurate * Use `get_tapping_term(tapping_key.event)` instead `e` doesn't include column and row information, properly. It registers as 255, regardless of the actual keypress. However `tapping_key.event` actually gives the correct column and row information. It appears be the correct structure to use. In fact, it looks like the issue is that `e` is actually the "TICK" structure, as defined in keyboard.h * Use variable tapping term value rather than define * Silly drashna - tapping_key.event, not event * add get_event_keycode() function * Fix typo Co-Authored-By: drashna <drashna@live.com> * Remove post_process_record_quantum since it's the wrong PR * Update quantum/quantum.c Co-Authored-By: drashna <drashna@live.com> * Better handle ifdef statement for permissive hold Since we can't be sure that tapping term is actually 500 * Update quantum.c comments based on feedback * Clean up get_tapping_term function Clean up function so that users don't need to call the event function, and instead only check the keycode * Add ability to run functionality on and off * Make ifdef's more compact
* Add customizable tapping terms * Add Documentation * Fix function * Fixes * It's not a pointer * Add debugging output * Update documentation to be at least vaguely accurate * Use `get_tapping_term(tapping_key.event)` instead `e` doesn't include column and row information, properly. It registers as 255, regardless of the actual keypress. However `tapping_key.event` actually gives the correct column and row information. It appears be the correct structure to use. In fact, it looks like the issue is that `e` is actually the "TICK" structure, as defined in keyboard.h * Use variable tapping term value rather than define * Silly drashna - tapping_key.event, not event * add get_event_keycode() function * Fix typo Co-Authored-By: drashna <drashna@live.com> * Remove post_process_record_quantum since it's the wrong PR * Update quantum/quantum.c Co-Authored-By: drashna <drashna@live.com> * Better handle ifdef statement for permissive hold Since we can't be sure that tapping term is actually 500 * Update quantum.c comments based on feedback * Clean up get_tapping_term function Clean up function so that users don't need to call the event function, and instead only check the keycode * Add ability to run functionality on and off * Make ifdef's more compact
* Fix bug in PERMISSIVE_HOLD check caused by #5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
* Fix bug in PERMISSIVE_HOLD check caused by qmk#5009 (aka, me) * Remove check for per key
Description
Allow a user customizable tapping term, that is configurable, per key. In theory.
However, it doesn't work correctly. The default value works, but I can't seem to get it to properly work using the
keycode
, but does work if you specify the Row and Column of the key.This is not ideal, at all. But I'm not sure sure how to fix this issue. So, I'm opening the pull request to get some input on this, and see if somebody can help me get this working "properly".
This isn't originally my code, but is fredizzimo and @danielo515
Types of changes
Issues Fixed or Closed by this PR
Checklist: