summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-07-22 20:23:57 -0700
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-07-22 20:23:57 -0700
commit3261c408e454dbc3cc2a1591ba62575036af19ad (patch)
treebf877266d79a30b5e0ab8cb115338e7382702259
parentd41961c9eddb78591d3b55ea65e6e0baff4bdd69 (diff)
Add support for TAP_CODE_DELAY to Hold-Tap keys (#5400)0.6.435
* Add support for TAP_CODE_DELAY to Hold-Tap keys * Better handling for tap code delay and caps version
-rw-r--r--tmk_core/common/action.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 285786cb7c..5172e8650a 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -44,6 +44,9 @@ int retro_tapping_counter = 0;
#include <fauxclicky.h>
#endif
+#ifndef TAP_CODE_DELAY
+# define TAP_CODE_DELAY 0
+#endif
#ifndef TAP_HOLD_CAPS_DELAY
# define TAP_HOLD_CAPS_DELAY 80
#endif
@@ -330,6 +333,9 @@ void process_action(keyrecord_t *record, action_t action)
} else {
if (tap_count > 0) {
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);
} else {
dprint("MODS_TAP: No tap: add_mods\n");
@@ -522,7 +528,9 @@ void process_action(keyrecord_t *record, action_t action)
dprint("KEYMAP_TAP_KEY: Tap: unregister_code\n");
if (action.layer_tap.code == KC_CAPS) {
wait_ms(TAP_HOLD_CAPS_DELAY);
- }
+ } else {
+ wait_ms(TAP_CODE_DELAY);
+ }
unregister_code(action.layer_tap.code);
} else {
dprint("KEYMAP_TAP_KEY: No tap: Off on release\n");
@@ -618,6 +626,7 @@ void process_action(keyrecord_t *record, action_t action)
if (event.pressed) {
register_code(action.swap.code);
} else {
+ wait_ms(TAP_CODE_DELAY);
unregister_code(action.swap.code);
*record = (keyrecord_t){}; // hack: reset tap mode
}
@@ -670,8 +679,7 @@ void process_action(keyrecord_t *record, action_t action)
retro_tapping_counter = 0;
} else {
if (retro_tapping_counter == 2) {
- register_code(action.layer_tap.code);
- unregister_code(action.layer_tap.code);
+ tap_code(action.layer_tap.code);
}
retro_tapping_counter = 0;
}
@@ -858,12 +866,9 @@ void tap_code(uint8_t code) {
register_code(code);
if (code == KC_CAPS) {
wait_ms(TAP_HOLD_CAPS_DELAY);
- }
- #if TAP_CODE_DELAY > 0
- else {
+ } else {
wait_ms(TAP_CODE_DELAY);
}
- #endif
unregister_code(code);
}