Add support for TAP_CODE_DELAY to Hold-Tap keys (#5400)
* Add support for TAP_CODE_DELAY to Hold-Tap keys * Better handling for tap code delay and caps version
This commit is contained in:
parent
d41961c9ed
commit
3261c408e4
1 changed files with 12 additions and 7 deletions
|
@ -44,6 +44,9 @@ int retro_tapping_counter = 0;
|
||||||
#include <fauxclicky.h>
|
#include <fauxclicky.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TAP_CODE_DELAY
|
||||||
|
# define TAP_CODE_DELAY 0
|
||||||
|
#endif
|
||||||
#ifndef TAP_HOLD_CAPS_DELAY
|
#ifndef TAP_HOLD_CAPS_DELAY
|
||||||
# define TAP_HOLD_CAPS_DELAY 80
|
# define TAP_HOLD_CAPS_DELAY 80
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,6 +333,9 @@ void process_action(keyrecord_t *record, action_t action)
|
||||||
} else {
|
} else {
|
||||||
if (tap_count > 0) {
|
if (tap_count > 0) {
|
||||||
dprint("MODS_TAP: Tap: unregister_code\n");
|
dprint("MODS_TAP: Tap: unregister_code\n");
|
||||||
|
if (action.layer_tap.code == KC_CAPS) {
|
||||||
|
wait_ms(TAP_HOLD_CAPS_DELAY);
|
||||||
|
}
|
||||||
unregister_code(action.key.code);
|
unregister_code(action.key.code);
|
||||||
} else {
|
} else {
|
||||||
dprint("MODS_TAP: No tap: add_mods\n");
|
dprint("MODS_TAP: No tap: add_mods\n");
|
||||||
|
@ -522,6 +528,8 @@ void process_action(keyrecord_t *record, action_t action)
|
||||||
dprint("KEYMAP_TAP_KEY: Tap: unregister_code\n");
|
dprint("KEYMAP_TAP_KEY: Tap: unregister_code\n");
|
||||||
if (action.layer_tap.code == KC_CAPS) {
|
if (action.layer_tap.code == KC_CAPS) {
|
||||||
wait_ms(TAP_HOLD_CAPS_DELAY);
|
wait_ms(TAP_HOLD_CAPS_DELAY);
|
||||||
|
} else {
|
||||||
|
wait_ms(TAP_CODE_DELAY);
|
||||||
}
|
}
|
||||||
unregister_code(action.layer_tap.code);
|
unregister_code(action.layer_tap.code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -618,6 +626,7 @@ void process_action(keyrecord_t *record, action_t action)
|
||||||
if (event.pressed) {
|
if (event.pressed) {
|
||||||
register_code(action.swap.code);
|
register_code(action.swap.code);
|
||||||
} else {
|
} else {
|
||||||
|
wait_ms(TAP_CODE_DELAY);
|
||||||
unregister_code(action.swap.code);
|
unregister_code(action.swap.code);
|
||||||
*record = (keyrecord_t){}; // hack: reset tap mode
|
*record = (keyrecord_t){}; // hack: reset tap mode
|
||||||
}
|
}
|
||||||
|
@ -670,8 +679,7 @@ void process_action(keyrecord_t *record, action_t action)
|
||||||
retro_tapping_counter = 0;
|
retro_tapping_counter = 0;
|
||||||
} else {
|
} else {
|
||||||
if (retro_tapping_counter == 2) {
|
if (retro_tapping_counter == 2) {
|
||||||
register_code(action.layer_tap.code);
|
tap_code(action.layer_tap.code);
|
||||||
unregister_code(action.layer_tap.code);
|
|
||||||
}
|
}
|
||||||
retro_tapping_counter = 0;
|
retro_tapping_counter = 0;
|
||||||
}
|
}
|
||||||
|
@ -858,12 +866,9 @@ void tap_code(uint8_t code) {
|
||||||
register_code(code);
|
register_code(code);
|
||||||
if (code == KC_CAPS) {
|
if (code == KC_CAPS) {
|
||||||
wait_ms(TAP_HOLD_CAPS_DELAY);
|
wait_ms(TAP_HOLD_CAPS_DELAY);
|
||||||
}
|
} else {
|
||||||
#if TAP_CODE_DELAY > 0
|
|
||||||
else {
|
|
||||||
wait_ms(TAP_CODE_DELAY);
|
wait_ms(TAP_CODE_DELAY);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
unregister_code(code);
|
unregister_code(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue