From edd1f33013084a79cffcfafafe7c2cbd381d6979 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Thu, 10 Mar 2022 05:43:12 +1100 Subject: Missed some erroneous prints. (#16597) --- quantum/action_tapping.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'quantum/action_tapping.c') diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index 6f8b4f8c56..e436619428 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -1,10 +1,5 @@ #include #include -#include "action.h" -#include "action_layer.h" -#include "action_tapping.h" -#include "keycode.h" -#include "timer.h" #ifdef DEBUG_ACTION # include "debug.h" @@ -12,6 +7,12 @@ # include "nodebug.h" #endif +#include "action.h" +#include "action_layer.h" +#include "action_tapping.h" +#include "keycode.h" +#include "timer.h" + #ifndef NO_ACTION_TAPPING # define IS_TAPPING() !IS_NOEVENT(tapping_key.event) -- cgit v1.2.3 From 8f585153c470b07bb0c529ff49b39ef45f68d37e Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Sat, 16 Apr 2022 20:24:09 +0200 Subject: Add GET_TAPPING_TERM macro to reduce duplicate code (#16681) * Add GET_TAPPING_TERM macro to reduce duplicate code The macro gives the right tapping term depending on whether per-key tapping terms and/or dynamic tapping terms are enabled. Unnecessary function calls and variable resolution are avoided. Fixes #16472. * Use GET_TAPPING_TERM for Cirque trackpads Co-authored-by: Stefan Kerkmann --- quantum/action_tapping.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'quantum/action_tapping.c') diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index e436619428..3c8b5678b7 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -24,17 +24,20 @@ # else # define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key)) && tapping_key.keycode == r->keycode) # endif +# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < GET_TAPPING_TERM(get_record_keycode(&tapping_key, false), &tapping_key)) +# ifdef DYNAMIC_TAPPING_TERM_ENABLE uint16_t g_tapping_term = TAPPING_TERM; +# endif +# ifdef TAPPING_TERM_PER_KEY __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { +# ifdef DYNAMIC_TAPPING_TERM_ENABLE return g_tapping_term; +# else + return TAPPING_TERM; +# endif } - -# ifdef TAPPING_TERM_PER_KEY -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_record_keycode(&tapping_key, false), &tapping_key)) -# else -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < g_tapping_term) # endif # ifdef TAPPING_FORCE_HOLD_PER_KEY @@ -165,15 +168,7 @@ bool process_tapping(keyrecord_t *keyp) { else if ( ( ( - ( -# ifdef TAPPING_TERM_PER_KEY - get_tapping_term(tapping_keycode, &tapping_key) -# else - g_tapping_term -# endif - >= 500 - ) - + GET_TAPPING_TERM(tapping_keycode, &tapping_key) >= 500 # ifdef PERMISSIVE_HOLD_PER_KEY || get_permissive_hold(tapping_keycode, &tapping_key) # elif defined(PERMISSIVE_HOLD) -- cgit v1.2.3