Skip to content

Commit

Permalink
[Keyboard] Fixed bugs Wuque Mammoth Keyboard Series (#15700)
Browse files Browse the repository at this point in the history
  • Loading branch information
spbgzh authored Jan 11, 2022
1 parent 0fc1ae9 commit 19fe7dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions keyboards/wuque/mammoth20x/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENCODERS_PAD_B { D2 }

#define ENCODERS 1

#ifdef ENCODER_RESOLUTION
#undef ENCODER_RESOLUTION
#endif
#define ENCODER_RESOLUTION 2

// Note: array is { col, row )
#define ENCODERS_CW_KEY { { 3, 2 } }
#define ENCODERS_CCW_KEY { { 3, 4 } }
4 changes: 2 additions & 2 deletions keyboards/wuque/mammoth20x/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, KC_PAUS, KC_DEL, KC_VOLU, KC_MUTE, KC_VOLD,
KC_LNUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_ESC, KC_PAUS, KC_DEL, KC_VOLD, KC_MUTE, KC_VOLU,
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3,
Expand Down
10 changes: 8 additions & 2 deletions keyboards/wuque/mammoth75x/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENCODERS_PAD_B { B1 }

#define ENCODERS 1

#ifdef ENCODER_RESOLUTION
#undef ENCODER_RESOLUTION
#endif
#define ENCODER_RESOLUTION 2

This comment has been minimized.

Copy link
@dcinzona

dcinzona Jan 27, 2023

ENCODER_RESOLUTION 2 results in 5 or 10 ticks to register a "key press". If I set resolution to 1, then the encoder registers every other tick (as expected)


// Note: array is { col, row )
#define ENCODERS_CW_KEY { { 5, 5 } }
#define ENCODERS_CCW_KEY { { 3, 5 } }
#define ENCODERS_CW_KEY { { 3, 5 } }

This comment has been minimized.

Copy link
@dcinzona

dcinzona Jan 27, 2023

This, in combination with the change to the VIA keymap.c file (flipping the knob definitions), makes the encoder register volume down clockwise and volume up counter-clockwise.

#define ENCODERS_CCW_KEY { { 5, 5 } }

#define LED_CAPS_LOCK_PIN B6
#define LED_PIN_ON_STATE 0

1 comment on commit 19fe7dc

@dcinzona
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current build I'm running on my two Mammoth75 boards:
Note the ENCODER_RESOLUTION being set to 1 and the ENCODER_DIRECTION_FLIP

I think the definition for CW_KEY and CCW_KEY are backwards (should be 5,5 for CW and 3,5 for CCW [col,row])

#pragma once

#include "config_common.h"

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16

#define MATRIX_ROW_PINS { B0, C7, D2, F7, D1, D0 }
#define MATRIX_COL_PINS { D3, D5, D4, D6, D7, B4, B5, E6, F0, F1, F4, F5, F6, C6, B7, B3 }

#define DIODE_DIRECTION COL2ROW

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE

/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* Enable encoder */
#define ENCODERS_PAD_A { B2 }
#define ENCODERS_PAD_B { B1 }

#define ENCODERS 1

#ifdef ENCODER_RESOLUTION
    #undef ENCODER_RESOLUTION
#endif
#define ENCODER_RESOLUTION 1
#define ENCODER_DEFAULT_POS 0x3

// Note:  array is { col, row )
#define ENCODERS_CW_KEY  { { 3, 5 } }
#define ENCODERS_CCW_KEY { { 5, 5 } }
#define ENCODER_DIRECTION_FLIP // Required due to flipping the keys on the VIA keymap.c file

#define LED_CAPS_LOCK_PIN B6
#define LED_PIN_ON_STATE 0

Please sign in to comment.