diff options
author | Ryan <[email protected]> | 2024-01-14 21:33:58 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-14 10:33:58 +0000 |
commit | 1bebaa310abb637cbca146b6d7859f3efe503cfd (patch) | |
tree | 3e93ae5a77901a57f8d998697efee1264d8a2a7d /lib/python/qmk/info.py | |
parent | e2517ff9a4652b62fb941f66ea76cac5d73146fb (diff) | |
download | qmk_firmware-1bebaa310abb637cbca146b6d7859f3efe503cfd.tar.gz qmk_firmware-1bebaa310abb637cbca146b6d7859f3efe503cfd.zip |
CLI: Allow generation of both LED and RGB Matrix config (#22896)
Diffstat (limited to 'lib/python/qmk/info.py')
-rw-r--r-- | lib/python/qmk/info.py | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index b018ba96fd..efe4dac34a 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -686,27 +686,23 @@ def _extract_led_config(info_data, keyboard): cols = info_data['matrix_size']['cols'] rows = info_data['matrix_size']['rows'] - # Determine what feature owns g_led_config - feature = None - for feat in ['rgb_matrix', 'led_matrix']: - if info_data.get('features', {}).get(feat, False) or feat in info_data: - feature = feat - - if feature: - # 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']) + for feature in ['rgb_matrix', 'led_matrix']: + if info_data.get('features', {}).get(feature, False) or feature in info_data: + + # 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 |