From b47f166d0f2e84cab78c429dd6c3443c9c34f5c2 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 5 Jul 2019 04:39:35 -0700 Subject: [PATCH 01/12] Update Space Cadet to use Custom Tapping Term functionality --- quantum/process_keycode/process_space_cadet.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 6833fdb9fb38..818d9c9c22f1 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -14,6 +14,9 @@ * along with this program. If not, see . */ #include "process_space_cadet.h" +#ifdef TAPPING_TERM_PER_KEY +# include "action_tapping.h" +#endif #ifndef TAPPING_TERM # define TAPPING_TERM 200 @@ -89,14 +92,17 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u if (record->event.pressed) { sc_last = holdMod; sc_timer = timer_read(); -#ifdef SPACE_CADET_MODIFIER_CARRYOVER - sc_mods = get_mods(); -#endif + if (IS_MOD(holdMod)) { register_mods(MOD_BIT(holdMod)); } } else { - if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) { +#ifdef TAPPING_TERM_PER_KEY + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(keycode)) +#else + if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) +#endif + { if (holdMod != tapMod) { if (IS_MOD(holdMod)) { unregister_mods(MOD_BIT(holdMod)); From 8b2cea70c4affd4437f92bb63c8329ccb236a608 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 5 Jul 2019 10:00:57 -0700 Subject: [PATCH 02/12] Detect correct keycode for space cadet tapping term --- quantum/process_keycode/process_space_cadet.c | 38 ++++++++++--------- quantum/process_keycode/process_space_cadet.h | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 818d9c9c22f1..3ba7246a8e83 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -88,17 +88,18 @@ static uint16_t sc_timer = 0; static uint8_t sc_mods = 0; #endif -void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { - if (record->event.pressed) { - sc_last = holdMod; - sc_timer = timer_read(); - - if (IS_MOD(holdMod)) { - register_mods(MOD_BIT(holdMod)); - } - } else { + +void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { + if (record->event.pressed) { + sc_last = holdMod; + sc_timer = timer_read (); + if (IS_MOD(holdMod)) { + register_mods(MOD_BIT(holdMod)); + } + } + else { #ifdef TAPPING_TERM_PER_KEY - if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(keycode)) + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(og_keycode)) #else if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) #endif @@ -130,33 +131,34 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u } bool process_space_cadet(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { + + switch(keycode) { case KC_LSPO: { - perform_space_cadet(record, LSPO_KEYS); + perform_space_cadet(record, keycode, LSPO_KEYS); return false; } case KC_RSPC: { - perform_space_cadet(record, RSPC_KEYS); + perform_space_cadet(record, keycode, RSPC_KEYS); return false; } case KC_LCPO: { - perform_space_cadet(record, LCPO_KEYS); + perform_space_cadet(record, keycode, LCPO_KEYS); return false; } case KC_RCPC: { - perform_space_cadet(record, RCPC_KEYS); + perform_space_cadet(record, keycode, RCPC_KEYS); return false; } case KC_LAPO: { - perform_space_cadet(record, LAPO_KEYS); + perform_space_cadet(record, keycode, LAPO_KEYS); return false; } case KC_RAPC: { - perform_space_cadet(record, RAPC_KEYS); + perform_space_cadet(record, keycode, RAPC_KEYS); return false; } case KC_SFTENT: { - perform_space_cadet(record, SFTENT_KEYS); + perform_space_cadet(record, keycode, SFTENT_KEYS); return false; } default: { diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h index c8231435046a..442bd3b9b41a 100644 --- a/quantum/process_keycode/process_space_cadet.h +++ b/quantum/process_keycode/process_space_cadet.h @@ -17,5 +17,5 @@ #include "quantum.h" -void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); +void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); bool process_space_cadet(uint16_t keycode, keyrecord_t *record); From a977fbb3fe3a965c06b524b5e5b4ed5f494cdeb0 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 7 Jul 2019 00:56:48 -0700 Subject: [PATCH 03/12] Update tap dancing to use global custom tapping term --- quantum/process_keycode/process_tap_dance.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 16756e59c204..d870b2202671 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -171,7 +171,11 @@ void matrix_scan_tap_dance() { if (action->custom_tapping_term > 0) { tap_user_defined = action->custom_tapping_term; } else { +#ifdef TAPPING_TERM_PER_KEY + tap_user_defined = get_tapping_term(action->state.keycode - QK_TAP_DANCE); +#else tap_user_defined = TAPPING_TERM; +#endif } if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { process_tap_dance_action_on_dance_finished(action); From 67232714c645090b36c5ce56c1069e53cad30a32 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 7 Jul 2019 00:57:50 -0700 Subject: [PATCH 04/12] Update documentation for Tap Dances --- docs/feature_tap_dance.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index 877c37336ec3..3cb959ae686d 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md @@ -28,7 +28,9 @@ After this, you'll want to use the `tap_dance_actions` array to specify what act * `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode). * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets. -* `ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. +* ~~`ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`~~: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. + * This is deprecated in favor of the Per Key Tapping Term functionality, as outlined [here](custom_quantum_functions.md#Custom_Tapping_Term). You'd want to check for the specific `TD()` macro that you want to use (such as `TD(TD_ESC_CAPS)`) instead of using this specific. + The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. From 09c7115e092b38531220c6e38d545c5682019468 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Wed, 30 Oct 2019 17:17:29 -0700 Subject: [PATCH 05/12] formatting pass --- quantum/process_keycode/process_space_cadet.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 3ba7246a8e83..62b578cd1076 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -15,7 +15,7 @@ */ #include "process_space_cadet.h" #ifdef TAPPING_TERM_PER_KEY -# include "action_tapping.h" +# include "action_tapping.h" #endif #ifndef TAPPING_TERM @@ -88,16 +88,14 @@ static uint16_t sc_timer = 0; static uint8_t sc_mods = 0; #endif - void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { - if (record->event.pressed) { - sc_last = holdMod; - sc_timer = timer_read (); - if (IS_MOD(holdMod)) { - register_mods(MOD_BIT(holdMod)); - } - } - else { + if (record->event.pressed) { + sc_last = holdMod; + sc_timer = timer_read(); + if (IS_MOD(holdMod)) { + register_mods(MOD_BIT(holdMod)); + } + } else { #ifdef TAPPING_TERM_PER_KEY if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(og_keycode)) #else @@ -131,8 +129,7 @@ void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdM } bool process_space_cadet(uint16_t keycode, keyrecord_t *record) { - - switch(keycode) { + switch (keycode) { case KC_LSPO: { perform_space_cadet(record, keycode, LSPO_KEYS); return false; From 9a2ed06407f91931384247f99c8ef26284327c6f Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 28 Jan 2020 22:28:03 -0800 Subject: [PATCH 06/12] Apply suggestions from code review Co-Authored-By: fauxpark --- quantum/process_keycode/process_space_cadet.c | 4 ++-- quantum/process_keycode/process_space_cadet.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 62b578cd1076..14497dc6c26d 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -88,7 +88,7 @@ static uint16_t sc_timer = 0; static uint8_t sc_mods = 0; #endif -void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { +void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) { if (record->event.pressed) { sc_last = holdMod; sc_timer = timer_read(); @@ -97,7 +97,7 @@ void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdM } } else { #ifdef TAPPING_TERM_PER_KEY - if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(og_keycode)) + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode)) #else if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) #endif diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h index 442bd3b9b41a..fcb70f3b4369 100644 --- a/quantum/process_keycode/process_space_cadet.h +++ b/quantum/process_keycode/process_space_cadet.h @@ -17,5 +17,5 @@ #include "quantum.h" -void perform_space_cadet(keyrecord_t *record, uint16_t og_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); +void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); bool process_space_cadet(uint16_t keycode, keyrecord_t *record); From 8328cd4e140e9880a42d95949a5abfb865f20c16 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 2 May 2020 16:27:19 -0700 Subject: [PATCH 07/12] Update docs/feature_tap_dance.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> --- docs/feature_tap_dance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index 3cb959ae686d..d2da39ad2b77 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md @@ -29,7 +29,7 @@ After this, you'll want to use the `tap_dance_actions` array to specify what act * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets. * ~~`ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`~~: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`. - * This is deprecated in favor of the Per Key Tapping Term functionality, as outlined [here](custom_quantum_functions.md#Custom_Tapping_Term). You'd want to check for the specific `TD()` macro that you want to use (such as `TD(TD_ESC_CAPS)`) instead of using this specific. + * This is deprecated in favor of the Per Key Tapping Term functionality, as outlined [here](custom_quantum_functions.md#Custom_Tapping_Term). You'd want to check for the specific `TD()` macro that you want to use (such as `TD(TD_ESC_CAPS)`) instead of using this specific Tap Dance function. The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. From 9e854753890ea6a27a0b99cd7f97bf65929a1b6b Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Sat, 2 May 2020 16:45:19 -0700 Subject: [PATCH 08/12] Update for future --- quantum/process_keycode/process_space_cadet.c | 5 ++++- quantum/process_keycode/process_tap_dance.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 14497dc6c26d..dc85524f9e67 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -92,12 +92,15 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM if (record->event.pressed) { sc_last = holdMod; sc_timer = timer_read(); +#ifdef SPACE_CADET_MODIFIER_CARRYOVER + sc_mods = get_mods(); +#endif if (IS_MOD(holdMod)) { register_mods(MOD_BIT(holdMod)); } } else { #ifdef TAPPING_TERM_PER_KEY - if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode)) + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode record->event)) #else if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) #endif diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index d870b2202671..a3a8798fe184 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -172,7 +172,7 @@ void matrix_scan_tap_dance() { tap_user_defined = action->custom_tapping_term; } else { #ifdef TAPPING_TERM_PER_KEY - tap_user_defined = get_tapping_term(action->state.keycode - QK_TAP_DANCE); + tap_user_defined = get_tapping_term(action->state.keycode - QK_TAP_DANCE, NULL); #else tap_user_defined = TAPPING_TERM; #endif From de451b24e124079b4cc4bb136c366e8122f2cb0c Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Sat, 2 May 2020 17:03:06 -0700 Subject: [PATCH 09/12] Update user keymaps for space cadet --- keyboards/converter/usb_usb/keymaps/narze/keymap.c | 6 +++--- keyboards/ergodox_infinity/keymaps/narze/keymap.c | 6 +++--- keyboards/planck/keymaps/narze/keymap.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/keyboards/converter/usb_usb/keymaps/narze/keymap.c b/keyboards/converter/usb_usb/keymaps/narze/keymap.c index 510b93b7ad84..a84d613a2d36 100644 --- a/keyboards/converter/usb_usb/keymaps/narze/keymap.c +++ b/keyboards/converter/usb_usb/keymaps/narze/keymap.c @@ -130,17 +130,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // 1. Hold for LGUI, tap for Underscore case GUI_UNDS: - perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); + perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS); return false; // 2. Hold for LSHIFT, tap for Parens open case LSFT_LPRN: - perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); + perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9); return false; // 3. Hold for RSHIFT, tap for Parens close case RSFT_RPRN: - perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0); + perform_space_cadet(record, keycode, KC_RSFT, KC_RSFT, KC_0); return false; default: diff --git a/keyboards/ergodox_infinity/keymaps/narze/keymap.c b/keyboards/ergodox_infinity/keymaps/narze/keymap.c index dcabd657b03c..d9499f00376c 100644 --- a/keyboards/ergodox_infinity/keymaps/narze/keymap.c +++ b/keyboards/ergodox_infinity/keymaps/narze/keymap.c @@ -635,17 +635,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // 1. Hold for LGUI, tap for Underscore case GUI_UNDS: - perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); + perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS); return false; // 2. Hold for LSHIFT, tap for Parens open case LSFT_LPRN: - perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); + perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9); return false; // 3. Hold for RSHIFT, tap for Parens close case RSFT_RPRN: - perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0); + perform_space_cadet(record, keycode, KC_RSFT, KC_RSFT, KC_0); return false; } diff --git a/keyboards/planck/keymaps/narze/keymap.c b/keyboards/planck/keymaps/narze/keymap.c index 7fead3205889..81cb68ecc910 100644 --- a/keyboards/planck/keymaps/narze/keymap.c +++ b/keyboards/planck/keymaps/narze/keymap.c @@ -330,12 +330,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // 1. Hold for LGUI, tap for Underscore case GUI_UNDS: - perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); + perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS); return false; // 2. Hold for LSHIFT, tap for Parens open case LSFT_LPRN: - perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); + perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9); return false; default: From 9649ccaae9aae065a761b6f7f7e482f8cda1eef5 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 2 May 2020 20:04:54 -0700 Subject: [PATCH 10/12] Fix typos --- quantum/process_keycode/process_space_cadet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index dc85524f9e67..573114ae808b 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -100,7 +100,7 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM } } else { #ifdef TAPPING_TERM_PER_KEY - if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode record->event)) + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) #else if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) #endif From b5b8f30087999b6f2fc617f1da0edd839eedb30c Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Sun, 19 Jul 2020 14:44:29 -0700 Subject: [PATCH 11/12] Clean up tapping term stuff --- quantum/process_keycode/process_space_cadet.c | 14 ++------------ quantum/process_keycode/process_tap_dance.c | 10 +--------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 573114ae808b..aba92f6577b0 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -14,13 +14,8 @@ * along with this program. If not, see . */ #include "process_space_cadet.h" -#ifdef TAPPING_TERM_PER_KEY -# include "action_tapping.h" -#endif +#include "action_tapping.h" -#ifndef TAPPING_TERM -# define TAPPING_TERM 200 -#endif // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** // Shift / paren setup @@ -99,12 +94,7 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM register_mods(MOD_BIT(holdMod)); } } else { -#ifdef TAPPING_TERM_PER_KEY - if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) -#else - if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) -#endif - { + if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) { if (holdMod != tapMod) { if (IS_MOD(holdMod)) { unregister_mods(MOD_BIT(holdMod)); diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index a3a8798fe184..0c7b6353eb51 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -16,10 +16,6 @@ #include "quantum.h" #include "action_tapping.h" -#ifndef TAPPING_TERM -# define TAPPING_TERM 200 -#endif - #ifndef NO_ACTION_ONESHOT uint8_t get_oneshot_mods(void); #endif @@ -171,11 +167,7 @@ void matrix_scan_tap_dance() { if (action->custom_tapping_term > 0) { tap_user_defined = action->custom_tapping_term; } else { -#ifdef TAPPING_TERM_PER_KEY - tap_user_defined = get_tapping_term(action->state.keycode - QK_TAP_DANCE, NULL); -#else - tap_user_defined = TAPPING_TERM; -#endif + tap_user_defined = get_tapping_term(action->state.keycode, NULL); } if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) { process_tap_dance_action_on_dance_finished(action); From be76e443c64b8eaaeb5510362f633393e1b2a8bf Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Sun, 19 Jul 2020 15:12:24 -0700 Subject: [PATCH 12/12] Fix compiler issue if NO_ACTION_TAPPING is enabled --- quantum/process_keycode/process_space_cadet.c | 3 +++ quantum/process_keycode/process_space_cadet.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index aba92f6577b0..bcaf62a964ec 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c @@ -16,6 +16,9 @@ #include "process_space_cadet.h" #include "action_tapping.h" +#ifdef NO_ACTION_TAPPING +__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; }; +#endif // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** // Shift / paren setup diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h index fcb70f3b4369..3ace073997af 100644 --- a/quantum/process_keycode/process_space_cadet.h +++ b/quantum/process_keycode/process_space_cadet.h @@ -19,3 +19,6 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); bool process_space_cadet(uint16_t keycode, keyrecord_t *record); +#ifdef NO_ACTION_TAPPING +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); +#endif