From ea7194544187c89c0c69dd035d5cd1860ce6813c Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 31 Mar 2024 21:38:58 +0100 Subject: [PATCH] Align encoder layout validation with encoder.h logic (#23330) --- keyboards/zvecr/zv48/info.json | 4 ++-- lib/python/qmk/info.py | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/keyboards/zvecr/zv48/info.json b/keyboards/zvecr/zv48/info.json index e58651499a..cd81109ed1 100644 --- a/keyboards/zvecr/zv48/info.json +++ b/keyboards/zvecr/zv48/info.json @@ -56,7 +56,7 @@ "layouts": { "LAYOUT_ortho_4x12": { "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, 2], "x": 2, "y": 0}, {"matrix": [0, 3], "x": 3, "y": 0}, @@ -67,7 +67,7 @@ {"matrix": [4, 3], "x": 8, "y": 0}, {"matrix": [4, 2], "x": 9, "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, 1], "x": 1, "y": 1}, diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 71bb6e9454..e463ac8ce7 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -58,8 +58,13 @@ def _get_key_left_position(key): def _find_invalid_encoder_index(info_data): """Perform additional validation of encoders """ - enc_count = len(info_data.get('encoder', {}).get('rotary', [])) - enc_count += len(info_data.get('split', {}).get('encoder', {}).get('right', {}).get('rotary', [])) + enc_left = info_data.get('encoder', {}).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 = [] layouts = info_data.get('layouts', {})