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
This commit is contained in:
		
							parent
							
								
									c38fe49242
								
							
						
					
					
						commit
						810eafad12
					
				
					 8 changed files with 19 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -17,3 +17,4 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
// place overrides here
 | 
			
		||||
#define TAPPING_TOGGLE 2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,9 +15,6 @@
 | 
			
		|||
 */
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
#define TAPPING_TOGGLE 2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Layer names
 | 
			
		||||
#define base  0
 | 
			
		||||
#define shrek 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		|||
  )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
uint16_t get_tapping_term(uint16_t keycode) {
 | 
			
		||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  switch (keycode) {
 | 
			
		||||
    case KC_SPRA:
 | 
			
		||||
      return TAPPING_LAYER_TERM;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,10 +16,6 @@
 | 
			
		|||
#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
 | 
			
		||||
#ifndef LSPO_KEY
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +93,12 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM
 | 
			
		|||
            register_mods(MOD_BIT(holdMod));
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) {
 | 
			
		||||
#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 (holdMod != tapMod) {
 | 
			
		||||
                if (IS_MOD(holdMod)) {
 | 
			
		||||
                    unregister_mods(MOD_BIT(holdMod));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,3 @@
 | 
			
		|||
 | 
			
		||||
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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#include "action_tapping.h"
 | 
			
		||||
 | 
			
		||||
#ifndef NO_ACTION_ONESHOT
 | 
			
		||||
uint8_t get_oneshot_mods(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +166,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, NULL);
 | 
			
		||||
#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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,7 @@
 | 
			
		|||
#include "config_common.h"
 | 
			
		||||
#include "led.h"
 | 
			
		||||
#include "action_util.h"
 | 
			
		||||
#include "action_tapping.h"
 | 
			
		||||
#include "print.h"
 | 
			
		||||
#include "send_string_keycodes.h"
 | 
			
		||||
#include "suspend.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,8 +22,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#    define TAPPING_TERM 200
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
//#define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, as long as there was no interruption
 | 
			
		||||
 | 
			
		||||
/* tap count needed for toggling a feature */
 | 
			
		||||
#ifndef TAPPING_TOGGLE
 | 
			
		||||
#    define TAPPING_TOGGLE 5
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +31,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#ifndef NO_ACTION_TAPPING
 | 
			
		||||
uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
 | 
			
		||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
void     action_tapping_process(keyrecord_t record);
 | 
			
		||||
 | 
			
		||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
bool get_retro_tapping(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue