diff options
author | Josh Johnson <josh@joshajohnson.com> | 2020-06-15 19:17:30 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 02:17:30 -0700 |
commit | da76734fe0aba64140d4d127161cc4390776ffd7 (patch) | |
tree | 3e05a8c528af167180cc02d1b4c9e7870c88b423 | |
parent | c029c5b187508755b2030354906a55d1c5349a9e (diff) | |
download | qmk_firmware-da76734fe0aba64140d4d127161cc4390776ffd7.tar.gz qmk_firmware-da76734fe0aba64140d4d127161cc4390776ffd7.zip |
[Keyboard] Hub16 keymap bugfix (#9345)
-rwxr-xr-x | keyboards/hub16/config.h | 3 | ||||
-rwxr-xr-x | keyboards/hub16/keymaps/default/keymap.c | 32 | ||||
-rwxr-xr-x | keyboards/hub16/readme.md | 4 |
3 files changed, 26 insertions, 13 deletions
diff --git a/keyboards/hub16/config.h b/keyboards/hub16/config.h index c7dec995eb..ed14178d60 100755 --- a/keyboards/hub16/config.h +++ b/keyboards/hub16/config.h @@ -81,8 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DEBOUNCE 20 /* ENCODER THINGS */ - -// #define NUMBER_OF_ENCODERS 2 +// #define ENCODER_DIRECTION_FLIP #define ENCODERS_PAD_A \ { F6, B4 } #define ENCODERS_PAD_B \ diff --git a/keyboards/hub16/keymaps/default/keymap.c b/keyboards/hub16/keymaps/default/keymap.c index 2d12dba0d4..d3cad67ae1 100755 --- a/keyboards/hub16/keymaps/default/keymap.c +++ b/keyboards/hub16/keymaps/default/keymap.c @@ -21,16 +21,18 @@ // Keyboard Layers enum keyboard_layers{ _BASE = 0, - _CONTROL + _CTRL }; // Tap Dance Declarations -enum tap_dance { TD_TO_LED = 0, TD_TO_DEFAULT = 1 }; +void td_ctrl (qk_tap_dance_state_t *state, void *user_data); + +enum tap_dance { CTRL = 0, BASE = 1 }; qk_tap_dance_action_t tap_dance_actions[] = { - // Tap once for standard key, twice to toggle to control layer - [TD_TO_LED] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _CONTROL), - [TD_TO_DEFAULT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_P, _BASE)}; + // Tap once for standard key on base layer, twice to toggle to control layer + [CTRL] = ACTION_TAP_DANCE_FN(td_ctrl), + [BASE] = ACTION_TAP_DANCE_LAYER_MOVE(_______, _BASE)}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT( /* Base */ @@ -38,19 +40,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G, KC_H, KC_I, KC_J, KC_K, KC_L, - KC_M, KC_N, KC_O, TD(TD_TO_LED) + KC_M, KC_N, KC_O, TD(CTRL) ), - [_CONTROL] = LAYOUT( /* LED Control */ + [_CTRL] = LAYOUT( /* Control */ KC_NO, KC_NO, _______, RGB_MOD, RGB_RMOD, RGB_TOG, RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, - _______, _______, RESET, TD(TD_TO_DEFAULT) + _______, _______, RESET, TD(BASE) ), }; -// Keyboard is setup to 'warp' the pressed key with F24, +// Keyboard is setup to 'wrap' the pressed key with an unused Fxx key, // allowing for easy differentiation from a real keyboard. void encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* Left Encoder */ @@ -99,3 +101,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } + +// Below works around TD() not running key press through process_record_user. +// Fixes bug of CTRL layer move key not being wrapped in by modifier on single tap +void td_ctrl (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code(KC_WRAP); + tap_code(KC_P); + unregister_code(KC_WRAP); + } else if (state->count == 2) { + layer_move(_CTRL); + } +}
\ No newline at end of file diff --git a/keyboards/hub16/readme.md b/keyboards/hub16/readme.md index 996fa44635..1409af5bbe 100755 --- a/keyboards/hub16/readme.md +++ b/keyboards/hub16/readme.md @@ -1,8 +1,8 @@ # Hub16 -Hub16 is a 16 Key Macro Pad with inbuilt USB 2.0 hub and dual rotary encoders. +Hub16 is a 16 Key Macro Pad with an inbuilt USB 2.0 hub and dual rotary encoders. -For more information regarding the keyboard, please visit the [Hub16 Webpage](https://www.joshajohnson.com/hub16-keyboard/) or [GitHub Repo](https://github.com/joshajohnson/Hub16). +For more information regarding the keyboard, please visit the [Hub16 Website](https://www.joshajohnson.com/hub16-keyboard/) or [GitHub Repo](https://github.com/joshajohnson/Hub16). * Keyboard Maintainer: [Josh Johnson](https://github.com/joshajohnson) * Hardware Supported: Hub16 PCB (atmega32u4) |