summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-11-01 01:26:24 +0000
committerGitHub <noreply@github.com>2023-11-01 01:26:24 +0000
commitfbbb221a31a4890a3302a4b169465d9efb0c59ed (patch)
tree772837b094def311ed8bf7354c7b607373936733 /lib/python/qmk/cli/generate
parenta19ae3d78466588caa9caf7c38d1617932255733 (diff)
Implement data driven lighting defaults (#21825)
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index 2c624e3e9a..00fb1d9585 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -165,10 +165,13 @@ def generate_split_config(kb_info_json, config_h_lines):
generate_encoder_config(kb_info_json['split']['encoder']['right'], config_h_lines, '_RIGHT')
-def generate_led_animations_config(led_feature_json, config_h_lines, prefix):
+def generate_led_animations_config(feature, led_feature_json, config_h_lines, enable_prefix, animation_prefix):
+ if 'animation' in led_feature_json.get('default', {}):
+ config_h_lines.append(generate_define(f'{feature.upper()}_DEFAULT_MODE', f'{animation_prefix}{led_feature_json["default"]["animation"].upper()}'))
+
for animation in led_feature_json.get('animations', {}):
if led_feature_json['animations'][animation]:
- config_h_lines.append(generate_define(f'{prefix}{animation.upper()}'))
+ config_h_lines.append(generate_define(f'{enable_prefix}{animation.upper()}'))
@cli.argument('filename', nargs='?', arg_only=True, type=FileType('r'), completer=FilesCompleter('.json'), help='A configurator export JSON to be compiled and flashed or a pre-compiled binary firmware file (bin/hex) to be flashed.')
@@ -209,13 +212,13 @@ def generate_config_h(cli):
generate_split_config(kb_info_json, config_h_lines)
if 'led_matrix' in kb_info_json:
- generate_led_animations_config(kb_info_json['led_matrix'], config_h_lines, 'ENABLE_LED_MATRIX_')
+ generate_led_animations_config('led_matrix', kb_info_json['led_matrix'], config_h_lines, 'ENABLE_LED_MATRIX_', 'LED_MATRIX_')
if 'rgb_matrix' in kb_info_json:
- generate_led_animations_config(kb_info_json['rgb_matrix'], config_h_lines, 'ENABLE_RGB_MATRIX_')
+ generate_led_animations_config('rgb_matrix', kb_info_json['rgb_matrix'], config_h_lines, 'ENABLE_RGB_MATRIX_', 'RGB_MATRIX_')
if 'rgblight' in kb_info_json:
- generate_led_animations_config(kb_info_json['rgblight'], config_h_lines, 'RGBLIGHT_EFFECT_')
+ generate_led_animations_config('rgblight', kb_info_json['rgblight'], config_h_lines, 'RGBLIGHT_EFFECT_', 'RGBLIGHT_MODE_')
# Show the results
dump_lines(cli.args.output, config_h_lines, cli.args.quiet)