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
master
Joel Challis 2024-01-04 05:47:52 +00:00 committed by GitHub
parent f583d2fef0
commit 5267329caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 16 deletions

View File

@ -684,26 +684,26 @@ def _extract_led_config(info_data, keyboard):
rows = info_data['matrix_size']['rows'] rows = info_data['matrix_size']['rows']
# Determine what feature owns g_led_config # Determine what feature owns g_led_config
features = info_data.get("features", {})
feature = None feature = None
if features.get("rgb_matrix", False): for feat in ['rgb_matrix', 'led_matrix']:
feature = "rgb_matrix" if info_data.get('features', {}).get(feat, False) or feat in info_data:
elif features.get("led_matrix", False): feature = feat
feature = "led_matrix"
if feature: if feature:
# Only attempt search if dd led config is missing
if 'layout' not in info_data.get(feature, {}):
# Process # Process
for file in find_keyboard_c(keyboard): for file in find_keyboard_c(keyboard):
try: try:
ret = find_led_config(file, cols, rows) ret = find_led_config(file, cols, rows)
if ret: if ret:
info_data[feature] = info_data.get(feature, {}) info_data[feature] = info_data.get(feature, {})
info_data[feature]["layout"] = ret info_data[feature]['layout'] = ret
except Exception as e: except Exception as e:
_log_warning(info_data, f'led_config: {file.name}: {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): 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"]) info_data[feature]['led_count'] = len(info_data[feature]['layout'])
return info_data return info_data