summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2024-01-04 05:47:52 +0000
committerGitHub <noreply@github.com>2024-01-04 05:47:52 +0000
commit5267329caa6ce08a5497d774bae0c8f386220a16 (patch)
treea439a372b258f70afa21db011765dae9739969b6 /lib/python
parentf583d2fef01372f55057dcf44569252e3582d0f5 (diff)
Ensure LED config is extracted when feature is disabled (#22809)
* Ensure LED config is extracted when feature is disabled * Only attempt LED search if dd led config is missing
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/qmk/info.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index d51741ecb6..e960bf20ee 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -684,26 +684,26 @@ def _extract_led_config(info_data, keyboard):
rows = info_data['matrix_size']['rows']
# Determine what feature owns g_led_config
- features = info_data.get("features", {})
feature = None
- if features.get("rgb_matrix", False):
- feature = "rgb_matrix"
- elif features.get("led_matrix", False):
- feature = "led_matrix"
+ for feat in ['rgb_matrix', 'led_matrix']:
+ if info_data.get('features', {}).get(feat, False) or feat in info_data:
+ feature = feat
if feature:
- # Process
- for file in find_keyboard_c(keyboard):
- try:
- ret = find_led_config(file, cols, rows)
- if ret:
- info_data[feature] = info_data.get(feature, {})
- info_data[feature]["layout"] = ret
- 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"])
+ # Only attempt search if dd led config is missing
+ if 'layout' not in info_data.get(feature, {}):
+ # Process
+ for file in find_keyboard_c(keyboard):
+ try:
+ ret = find_led_config(file, cols, rows)
+ if ret:
+ info_data[feature] = info_data.get(feature, {})
+ info_data[feature]['layout'] = ret
+ 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