summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-08-27 04:00:14 +0100
committerGitHub <noreply@github.com>2023-08-27 04:00:14 +0100
commit95681b8ff4a92aacd0249e124d34cf16e510175e (patch)
tree87f34e9fb6b35649bab9ad4996fd2179f2b53bbc /lib
parent25331be3164ca609ebecbfcc727ce904e3676594 (diff)
Add *_MATRIX_LED_COUNT generation (#21110)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/python/qmk/cli/info.py4
-rw-r--r--lib/python/qmk/info.py3
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py
index 02cc6051ec..e662407474 100755
--- a/lib/python/qmk/cli/info.py
+++ b/lib/python/qmk/cli/info.py
@@ -38,6 +38,10 @@ def _strip_api_content(info_json):
if 'matrix_pins' in info_json:
info_json.pop('matrix_size', None)
+ for feature in ['rgb_matrix', 'led_matrix']:
+ if info_json.get(feature, {}).get("layout", None):
+ info_json[feature].pop('led_count', None)
+
return info_json
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index dbd26153d8..9c8521a2a3 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -706,6 +706,9 @@ def _extract_led_config(info_data, keyboard):
except Exception as e:
_log_warning(info_data, f'led_config: {file.name}: {e}')
+ if info_data[feature].get("layout", None) and not info_data[feature].get("led_count", None):
+ info_data[feature]["led_count"] = len(info_data[feature]["layout"])
+
return info_data