Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add *_MATRIX_LED_COUNT generation #21110

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/mappings/info_config.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"LED_MATRIX_SPLIT": {"info_key": "led_matrix.split_count", "value_type": "array.int"},
"LED_MATRIX_TIMEOUT": {"info_key": "led_matrix.timeout", "value_type": "int"},
"LED_MATRIX_VAL_STEP": {"info_key": "led_matrix.val_steps", "value_type": "int"},
"LED_MATRIX_LED_COUNT": {"info_key": "led_matrix.led_count", "value_type": "int", "to_json": false},

// LUFA Bootloader
"QMK_ESC_INPUT": {"info_key": "qmk_lufa_bootloader.esc_input"},
Expand Down Expand Up @@ -109,6 +110,7 @@
"RGB_MATRIX_SPLIT": {"info_key": "rgb_matrix.split_count", "value_type": "array.int"},
"RGB_MATRIX_TIMEOUT": {"info_key": "rgb_matrix.timeout", "value_type": "int"},
"RGB_MATRIX_VAL_STEP": {"info_key": "rgb_matrix.val_steps", "value_type": "int"},
"RGB_MATRIX_LED_COUNT": {"info_key": "rgb_matrix.led_count", "value_type": "int", "to_json": false},

// RGBLight
"RGBLED_NUM": {"info_key": "rgblight.led_count", "value_type": "int"},
Expand Down
4 changes: 4 additions & 0 deletions lib/python/qmk/cli/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 3 additions & 0 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down