diff options
Diffstat (limited to 'keyboards/handwired')
5 files changed, 48 insertions, 36 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h index 915582c07e..260fa038e4 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h @@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ENCODERS_PAD_A \ { D5 } #define ENCODERS_PAD_B \ - { D6 } + { D4 } #define ENCODER_RESOLUTION 4 /* Set 0 if debouncing isn't needed */ diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index a57da64d54..61f302f168 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -140,9 +140,9 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { #else bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { - tap_code_delay(clockwise ? KC_VOLU : KC_VOLD, 5); + tap_code_delay(clockwise ? KC_VOLD : KC_VOLU, 5); } else if (index == 1) { - tap_code_delay(clockwise ? KC_WH_U : KC_WH_D, 5); + tap_code_delay(clockwise ? KC_WH_D : KC_WH_U, 5); } return false; } @@ -155,26 +155,29 @@ static uint16_t mouse_debounce_timer = 0; static uint8_t mouse_keycode_tracker = 0; bool tap_toggling = false; -void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { - if ((x || y) && timer_elapsed(mouse_timer) > 125) { - mouse_timer = timer_read(); - if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) { - layer_on(_MOUSE); - } - } - # ifdef TAPPING_TERM_PER_KEY - if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL) +# define TAP_CHECK get_tapping_term(KC_BTN1, NULL) # else - if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM +# ifndef TAPPING_TERM +# define TAPPING_TERM 200 +# endif +# define TAP_CHECK TAPPING_TERM # endif - || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) { - mouse_report->x = x; - mouse_report->y = y; - } + +void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { + if (x != 0 && y != 0) { + mouse_timer = timer_read(); # ifdef OLED_DRIVER_ENABLE - if (x || y) oled_timer = timer_read32(); + oled_timer = timer_read32(); # endif + if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) { + mouse_report->x = x; + mouse_report->y = y; + if (!layer_state_is(_MOUSE)) { + layer_on(_MOUSE); + } + } + } } void matrix_scan_keymap(void) { @@ -191,26 +194,29 @@ void matrix_scan_keymap(void) { bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { switch (keycode) { case TT(_MOUSE): - { - if (record->event.pressed) { - mouse_keycode_tracker++; - } else { + if (record->event.pressed) { + mouse_keycode_tracker++; + } else { # if TAPPING_TOGGLE != 0 - if (record->tap.count == TAPPING_TOGGLE) { - tap_toggling ^= 1; + if (record->tap.count == TAPPING_TOGGLE) { + tap_toggling ^= 1; # if TAPPING_TOGGLE == 1 - if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1; # else - if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; + if (!tap_toggling) mouse_keycode_tracker -= record->tap.count; # endif - } else { - mouse_keycode_tracker--; - } -# endif + } else { + mouse_keycode_tracker--; } - mouse_timer = timer_read(); - break; +# endif } + mouse_timer = timer_read(); + break; + case TG(_MOUSE): + if (record->event.pressed) { + tap_toggling ^= 1; + } + break; case MO(_MOUSE): case DPI_CONFIG: case KC_MS_UP ... KC_MS_WH_RIGHT: @@ -219,6 +225,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) { break; default: if (IS_NOEVENT(record->event)) break; + if ((keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) && (((keycode >> 0x8) & 0xF) == _MOUSE)) { + record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; + mouse_timer = timer_read(); + break; + } if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) { layer_off(_MOUSE); } diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk index b95b166d8d..585a2e9d8c 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk @@ -10,3 +10,5 @@ WPM_ENABLE = yes ENCODER_ENABLE = yes ENCODER_MAP_ENABLE = yes # DEBOUNCE_TYPE = sym_eager_pk + +LTO_SUPPORTED = no diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c index f0a611206d..0088fcc4f6 100644 --- a/keyboards/handwired/tractyl_manuform/tm_sync.c +++ b/keyboards/handwired/tractyl_manuform/tm_sync.c @@ -61,7 +61,7 @@ void keyboard_post_init_kb(void) { void kb_state_update(void) { # ifdef POINTING_DEVICE_ENABLE - if (is_keyboard_master() && !is_keyboard_left()) { + if (is_keyboard_master()) { static uint16_t cpi = 0; if (cpi != kb_state.device_cpi) { cpi = kb_state.device_cpi; diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index 49a8336829..e992c446cb 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c @@ -207,12 +207,11 @@ void master_mouse_send(int8_t x, int8_t y) { #endif } void trackball_set_cpi(uint16_t cpi) { - if (!is_keyboard_left()) { - pmw_set_cpi(cpi); - } else { #ifdef SPLIT_TRANSACTION_IDS_KB kb_state.device_cpi = cpi; #endif + if (!is_keyboard_left()) { + pmw_set_cpi(cpi); } } #endif |