diff options
author | Drashna Jaelre <drashna@live.com> | 2021-01-04 16:37:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 16:37:20 -0800 |
commit | 810eafad121bda333c53490e2d8a29f3a83d9c19 (patch) | |
tree | 975b8bd9c846d13f30da944e873326e0e0f69fa8 | |
parent | c38fe492426676cf101eeb024f7f33d8e98c445f (diff) | |
download | qmk_firmware-810eafad121bda333c53490e2d8a29f3a83d9c19.tar.gz qmk_firmware-810eafad121bda333c53490e2d8a29f3a83d9c19.zip |
Fix Tap-Hold Configs (#11127)
* Add proper prototypes for Tap-Hold Per Key functions
* Fix handwired/tennie default keymap
* Remove unneeded references
* Fix tapping term per key check in space cadet
* Pre-emptive fix for tap dance
* Fix marksard/leftover30
* Replace hard coded tapping term with define
-rw-r--r-- | keyboards/handwired/tennie/keymaps/default/config.h | 1 | ||||
-rw-r--r-- | keyboards/handwired/tennie/keymaps/default/keymap.c | 3 | ||||
-rw-r--r-- | keyboards/marksard/leftover30/keymaps/default/keymap.c | 2 | ||||
-rw-r--r-- | quantum/process_keycode/process_space_cadet.c | 11 | ||||
-rw-r--r-- | quantum/process_keycode/process_space_cadet.h | 3 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 5 | ||||
-rw-r--r-- | quantum/quantum.h | 1 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.h | 9 |
8 files changed, 19 insertions, 16 deletions
diff --git a/keyboards/handwired/tennie/keymaps/default/config.h b/keyboards/handwired/tennie/keymaps/default/config.h index 4496c5910..b8f7e4278 100644 --- a/keyboards/handwired/tennie/keymaps/default/config.h +++ b/keyboards/handwired/tennie/keymaps/default/config.h | |||
@@ -17,3 +17,4 @@ | |||
17 | #pragma once | 17 | #pragma once |
18 | 18 | ||
19 | // place overrides here | 19 | // place overrides here |
20 | #define TAPPING_TOGGLE 2 | ||
diff --git a/keyboards/handwired/tennie/keymaps/default/keymap.c b/keyboards/handwired/tennie/keymaps/default/keymap.c index 3736841cb..b65abb89e 100644 --- a/keyboards/handwired/tennie/keymaps/default/keymap.c +++ b/keyboards/handwired/tennie/keymaps/default/keymap.c | |||
@@ -15,9 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
17 | 17 | ||
18 | #define TAPPING_TOGGLE 2 | ||
19 | |||
20 | |||
21 | // Layer names | 18 | // Layer names |
22 | #define base 0 | 19 | #define base 0 |
23 | #define shrek 1 | 20 | #define shrek 1 |
diff --git a/keyboards/marksard/leftover30/keymaps/default/keymap.c b/keyboards/marksard/leftover30/keymaps/default/keymap.c index 60751cd1c..b8d997333 100644 --- a/keyboards/marksard/leftover30/keymaps/default/keymap.c +++ b/keyboards/marksard/leftover30/keymaps/default/keymap.c | |||
@@ -99,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
99 | ) | 99 | ) |
100 | }; | 100 | }; |
101 | 101 | ||
102 | uint16_t get_tapping_term(uint16_t keycode) { | 102 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { |
103 | switch (keycode) { | 103 | switch (keycode) { |
104 | case KC_SPRA: | 104 | case KC_SPRA: |
105 | return TAPPING_LAYER_TERM; | 105 | return TAPPING_LAYER_TERM; |
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index bcaf62a96..f99db2a87 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c | |||
@@ -16,10 +16,6 @@ | |||
16 | #include "process_space_cadet.h" | 16 | #include "process_space_cadet.h" |
17 | #include "action_tapping.h" | 17 | #include "action_tapping.h" |
18 | 18 | ||
19 | #ifdef NO_ACTION_TAPPING | ||
20 | __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; }; | ||
21 | #endif | ||
22 | |||
23 | // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** | 19 | // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** |
24 | // Shift / paren setup | 20 | // Shift / paren setup |
25 | #ifndef LSPO_KEY | 21 | #ifndef LSPO_KEY |
@@ -97,7 +93,12 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM | |||
97 | register_mods(MOD_BIT(holdMod)); | 93 | register_mods(MOD_BIT(holdMod)); |
98 | } | 94 | } |
99 | } else { | 95 | } else { |
100 | if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) { | 96 | #ifdef TAPPING_TERM_PER_KEY |
97 | if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) | ||
98 | #else | ||
99 | if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) | ||
100 | #endif | ||
101 | { | ||
101 | if (holdMod != tapMod) { | 102 | if (holdMod != tapMod) { |
102 | if (IS_MOD(holdMod)) { | 103 | if (IS_MOD(holdMod)) { |
103 | unregister_mods(MOD_BIT(holdMod)); | 104 | unregister_mods(MOD_BIT(holdMod)); |
diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h index 3ace07399..fcb70f3b4 100644 --- a/quantum/process_keycode/process_space_cadet.h +++ b/quantum/process_keycode/process_space_cadet.h | |||
@@ -19,6 +19,3 @@ | |||
19 | 19 | ||
20 | void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); | 20 | void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); |
21 | bool process_space_cadet(uint16_t keycode, keyrecord_t *record); | 21 | bool process_space_cadet(uint16_t keycode, keyrecord_t *record); |
22 | #ifdef NO_ACTION_TAPPING | ||
23 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); | ||
24 | #endif | ||
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 0c7b6353e..138de0eba 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | */ | 15 | */ |
16 | #include "quantum.h" | 16 | #include "quantum.h" |
17 | #include "action_tapping.h" | ||
18 | 17 | ||
19 | #ifndef NO_ACTION_ONESHOT | 18 | #ifndef NO_ACTION_ONESHOT |
20 | uint8_t get_oneshot_mods(void); | 19 | uint8_t get_oneshot_mods(void); |
@@ -167,7 +166,11 @@ void matrix_scan_tap_dance() { | |||
167 | if (action->custom_tapping_term > 0) { | 166 | if (action->custom_tapping_term > 0) { |
168 | tap_user_defined = action->custom_tapping_term; | 167 | tap_user_defined = action->custom_tapping_term; |
169 | } else { | 168 | } else { |
169 | #ifdef TAPPING_TERM_PER_KEY | ||
170 | tap_user_defined = get_tapping_term(action->state.keycode, NULL); | 170 | tap_user_defined = get_tapping_term(action->state.keycode, NULL); |
171 | #else | ||
172 | tap_user_defined = TAPPING_TERM; | ||
173 | #endif | ||
171 | } | 174 | } |
172 | if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { | 175 | if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { |
173 | process_tap_dance_action_on_dance_finished(action); | 176 | process_tap_dance_action_on_dance_finished(action); |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 3e09df4f8..f4df5bf15 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "config_common.h" | 56 | #include "config_common.h" |
57 | #include "led.h" | 57 | #include "led.h" |
58 | #include "action_util.h" | 58 | #include "action_util.h" |
59 | #include "action_tapping.h" | ||
59 | #include "print.h" | 60 | #include "print.h" |
60 | #include "send_string_keycodes.h" | 61 | #include "send_string_keycodes.h" |
61 | #include "suspend.h" | 62 | #include "suspend.h" |
diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h index 087090f80..4d10c668a 100644 --- a/tmk_core/common/action_tapping.h +++ b/tmk_core/common/action_tapping.h | |||
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
22 | # define TAPPING_TERM 200 | 22 | # define TAPPING_TERM 200 |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | //#define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, as long as there was no interruption | ||
26 | |||
27 | /* tap count needed for toggling a feature */ | 25 | /* tap count needed for toggling a feature */ |
28 | #ifndef TAPPING_TOGGLE | 26 | #ifndef TAPPING_TOGGLE |
29 | # define TAPPING_TOGGLE 5 | 27 | # define TAPPING_TOGGLE 5 |
@@ -33,6 +31,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
33 | 31 | ||
34 | #ifndef NO_ACTION_TAPPING | 32 | #ifndef NO_ACTION_TAPPING |
35 | uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); | 33 | uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); |
36 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); | ||
37 | void action_tapping_process(keyrecord_t record); | 34 | void action_tapping_process(keyrecord_t record); |
35 | |||
36 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); | ||
37 | bool get_permissive_hold(uint16_t keycode, keyrecord_t *record); | ||
38 | bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record); | ||
39 | bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record); | ||
40 | bool get_retro_tapping(uint16_t keycode, keyrecord_t *record); | ||
38 | #endif | 41 | #endif |