summary refs log tree commit diff
path: root/lib/python
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2023-03-24 02:47:22 +0000
committerQMK Bot <hello@qmk.fm>2023-03-24 02:47:22 +0000
commit2ae5a4a5353e0397ca654ed9573f1b5fe507fe10 (patch)
treec1fe4331b8cebbb54f9905e20853ad04385c6672 /lib/python
parent18fedc080a12cf5231e15fd27d0be840f3985ba7 (diff)
parentd6ce42ae5b1093eeae215c073c733c800195ec28 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/qmk/c_parse.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py
index 663688e240..7dd464bd34 100644
--- a/lib/python/qmk/c_parse.py
+++ b/lib/python/qmk/c_parse.py
@@ -90,8 +90,10 @@ def find_layouts(file):
                     cli.log.error('Invalid LAYOUT macro in %s: Empty parameter name in macro %s at pos %s.', file, macro_name, i)
                 elif key['label'] not in matrix_locations:
                     cli.log.error('Invalid LAYOUT macro in %s: Key %s in macro %s has no matrix position!', file, key['label'], macro_name)
+                elif len(matrix_locations.get(key['label'])) > 1:
+                    cli.log.error('Invalid LAYOUT macro in %s: Key %s in macro %s has multiple matrix positions (%s)', file, key['label'], macro_name, ', '.join(str(x) for x in matrix_locations[key['label']]))
                 else:
-                    key['matrix'] = matrix_locations[key['label']]
+                    key['matrix'] = matrix_locations[key['label']][0]
 
             parsed_layouts[macro_name] = {
                 'layout': parsed_layout,
@@ -186,7 +188,9 @@ def _parse_matrix_locations(matrix, file, macro_name):
         row = row.replace('{', '').replace('}', '')
         for col_num, identifier in enumerate(row.split(',')):
             if identifier != 'KC_NO':
-                matrix_locations[identifier] = [row_num, col_num]
+                if identifier not in matrix_locations:
+                    matrix_locations[identifier] = []
+                matrix_locations[identifier].append([row_num, col_num])
 
     return matrix_locations