qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.02k stars 38.74k forks source link

[Bug] Getting double key presses from second half #21048

Closed ilbalta closed 1 year ago

ilbalta commented 1 year ago

Describe the Bug

I have a custom ortholinear split keyboard with Serial communications based off 40percentclub's 5x5. Left (master) half works fine, right half works fine on the first 3/5 rows; the last two rows produce double key presses on any of the 10 columns so if the mapped keycode is KC_Q I get q on any key of the left half and any key of the right half's first 3 rows and qq on any key of the last 2 rows of the right half. It would seem to me like a debouncing issue were it not for the systemic nature of the issue affecting only the last 2 rows.

Keyboard Used

Custom ortholinear split based off 5x5 by 40percentclub

Link to product page (if applicable)

No response

Operating System

Windows

qmk doctor Output

[filip@JUGGERNAUT ~]$ qmk doctor                                                                                             
Ψ QMK Doctor is checking your environment.                                                                                   
Ψ CLI version: 1.1.1                                                                                                         
Ψ QMK home: C:/Users/filip/qmk_firmware                                                                                      
Ψ Detected Windows 10 (10.0.19045).                                                                                          
Ψ QMK MSYS version: 1.7.2                                                                                                    
Ψ Git branch: master                                                                                                         
Ψ Repo version: 0.20.5                                                                                                       
⚠ Git has unstashed/uncommitted changes.                                                                                     
Ψ - Latest master: 2023-04-23 12:07:35 -0700 (713427c086) -- Add KBDCraft Adam64 Lego board (#20503)                         
Ψ - Latest upstream/master: 2023-05-24 14:47:46 -0400 (f9c32974ef) -- Add encoder map FoldKB in VIA (#21038)                 
Ψ - Latest upstream/develop: None                                                                                            
Ψ - Common ancestor with upstream/master: 2023-04-23 12:07:35 -0700 (713427c086) -- Add KBDCraft Adam64 Lego board (#20503)  
Ψ - Common ancestor with upstream/develop: None                                                                              
Ψ All dependencies are installed.                                                                                            
Ψ Found arm-none-eabi-gcc version 10.1.0                                                                                     
Ψ Found avr-gcc version 8.5.0                                                                                                
Ψ Found avrdude version 7.0                                                                                                  
Ψ Found dfu-programmer version 0.7.2                                                                                         
Ψ Found dfu-util version 0.11                                                                                                
Ψ Submodules are up to date.                                                                                                 
Ψ Submodule status:                                                                                                          
Ψ - lib/chibios: 2023-01-03 19:29:26 +0000 --  (0062927e3)                                                                   
Ψ - lib/chibios-contrib: 2023-01-11 16:42:27 +0100 --  (a224be15)                                                            
Ψ - lib/googletest: 2021-06-11 06:37:43 -0700 --  (e2239ee6)                                                                 
Ψ - lib/lufa: 2022-08-26 12:09:55 +1000 --  (549b97320)                                                                      
Ψ - lib/vusb: 2022-06-13 09:18:17 +1000 --  (819dbc1)                                                                        
Ψ - lib/printf: 2022-06-29 23:59:58 +0300 --  (c2e3b4e)                                                                      
Ψ - lib/pico-sdk: 2023-02-12 20:19:37 +0100 --  (a3398d8)                                                                    
Ψ - lib/lvgl: 2022-04-11 04:44:53 -0600 --  (e19410f8)                                                                       
Ψ QMK is ready to go, but minor problems were found

Is AutoHotKey / Karabiner installed

Other keyboard-related software installed

Logitech g hub

Additional Context

rules.mk

BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = no         # Console for debug
COMMAND_ENABLE = yes        # Commands for debug and configuration
NKRO_ENABLE = yes           # Enable N-Key Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
AUDIO_ENABLE = no           # Audio output

# Enable generic behavior for split boards
SPLIT_KEYBOARD = yes

config.h

#pragma once

#define MASTER_LEFT

#define MATRIX_ROW_PINS { B2, B1, D0, D4, C6 }
#define MATRIX_COL_PINS { D7, E6, B4, B5, B6, B7, D6, F7, F6, F5}
#define SOFT_SERIAL_PIN D1

//#define SPLIT_LAYER_STATE_ENABLE

#define DIODE_DIRECTION COL2ROW

#define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE

5.5h

#pragma once

#include "quantum.h"
#define ___ KC_NO

#define LAYOUT_ortho_5x20( \
    L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, R00, R01, R02, R03, R04, R05, R06, R07, R08, R09, \
    L10, L11, L12, L13, L14, L15, L16, L17, L18, L19, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, \
    L20, L21, L22, L23, L24, L25, L26, L27, L28, L29, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, \
    L30, L31, L32, L33, L34, L35, L36, L37, L38, L39, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, \
    L40, L41, L42, L43, L44, L45, L46, L47, L48, L49, R40, R41, R42, R43, R44, R45, R46, R47, R48, R49  \
) { \
    { L00, L01, L02, L03, L04, L05, L06, L07, L08, L09 }, \
    { L10, L11, L12, L13, L14, L15, L16, L17, L18, L19 }, \
    { L20, L21, L22, L23, L24, L25, L26, L27, L28, L29 }, \
    { L30, L31, L32, L33, L34, L35, L36, L37, L38, L39 }, \
    { L40, L41, L42, L43, L44, L45, L46, L47, L48, L49 }, \
    { R00, R01, R02, R03, R04, R05, R06, R07, R08, R09 }, \
    { R10, R11, R12, R13, R14, R15, R16, R17, R18, R19 }, \
    { R20, R21, R22, R23, R24, R25, R26, R27, R28, R29 }, \
    { R30, R31, R32, R33, R34, R35, R36, R37, R38, R39 }, \
    { R40, R41, R42, R43, R44, R45, R46, R47, R48, R49 }  \
}

keymap.c

#include QMK_KEYBOARD_H

#define QWRT 0

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

    [QWRT] = LAYOUT_ortho_5x20(
         KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,
         KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,
         KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,
         KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,
         KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,      KC_P
    )
};

As a side note, this is my very first experience actually writing stuff for QMK, I had previously built a "classic" 5x5 and a 15x5 using 40percentclub's 5x5 boards and the "off the shelf" firmware flashing method. This build is me using the leftover pieces I had; sorry if there's something blatantly wrong, I tried sticking to the split keyboard guide as much as I could. ♥

ilbalta commented 1 year ago

Turns out I had botched the soldering and short-circuited the pins for row 3 and row 4 of the arduino. Using qmk console and this snippet in my keymap.c helped me easily identify the issue.

#include "print.h"
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    // If console is enabled, it will print the matrix position and status of each key pressed
#ifdef CONSOLE_ENABLE
    uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %u, time: %5u, int: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
#endif
    return true;
}

Sorry for the bother