1
0
Fork 0
forked from forks/qmk_firmware

Align encoder layout validation with encoder.h logic (#23330)

This commit is contained in:
Joel Challis 2024-03-31 21:38:58 +01:00 committed by GitHub
parent a939ee1197
commit ea71945441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View file

@ -56,7 +56,7 @@
"layouts": { "layouts": {
"LAYOUT_ortho_4x12": { "LAYOUT_ortho_4x12": {
"layout": [ "layout": [
{"matrix": [0, 0], "x": 0, "y": 0}, {"matrix": [0, 0], "x": 0, "y": 0, "encoder": 0},
{"matrix": [0, 1], "x": 1, "y": 0}, {"matrix": [0, 1], "x": 1, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0}, {"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0}, {"matrix": [0, 3], "x": 3, "y": 0},
@ -67,7 +67,7 @@
{"matrix": [4, 3], "x": 8, "y": 0}, {"matrix": [4, 3], "x": 8, "y": 0},
{"matrix": [4, 2], "x": 9, "y": 0}, {"matrix": [4, 2], "x": 9, "y": 0},
{"matrix": [4, 1], "x": 10, "y": 0}, {"matrix": [4, 1], "x": 10, "y": 0},
{"matrix": [4, 0], "x": 11, "y": 0}, {"matrix": [4, 0], "x": 11, "y": 0, "encoder": 1},
{"matrix": [1, 0], "x": 0, "y": 1}, {"matrix": [1, 0], "x": 0, "y": 1},
{"matrix": [1, 1], "x": 1, "y": 1}, {"matrix": [1, 1], "x": 1, "y": 1},

View file

@ -58,8 +58,13 @@ def _get_key_left_position(key):
def _find_invalid_encoder_index(info_data): def _find_invalid_encoder_index(info_data):
"""Perform additional validation of encoders """Perform additional validation of encoders
""" """
enc_count = len(info_data.get('encoder', {}).get('rotary', [])) enc_left = info_data.get('encoder', {}).get('rotary', [])
enc_count += len(info_data.get('split', {}).get('encoder', {}).get('right', {}).get('rotary', [])) enc_right = []
if info_data.get('split', {}).get('enabled', False):
enc_right = info_data.get('split', {}).get('encoder', {}).get('right', {}).get('rotary', enc_left)
enc_count = len(enc_left) + len(enc_right)
ret = [] ret = []
layouts = info_data.get('layouts', {}) layouts = info_data.get('layouts', {})