Generate DD RGBLight/LED/RGB Matrix animation defines (#18459)

This commit is contained in:
Ryan 2022-09-26 10:04:21 +10:00 committed by GitHub
parent 5c2b598c42
commit 675d91b813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 10 deletions

View File

@ -64,16 +64,6 @@
"RGB_DI_PIN": {"info_key": "rgblight.pin"},
"RGBLED_NUM": {"info_key": "rgblight.led_count", "value_type": "int"},
"RGBLED_SPLIT": {"info_key": "rgblight.split_count", "value_type": "array.int"},
"RGBLIGHT_EFFECT_ALTERNATING": {"info_key": "rgblight.animations.alternating", "value_type": "bool"},
"RGBLIGHT_EFFECT_BREATHING": {"info_key": "rgblight.animations.breathing", "value_type": "bool"},
"RGBLIGHT_EFFECT_CHRISTMAS": {"info_key": "rgblight.animations.christmas", "value_type": "bool"},
"RGBLIGHT_EFFECT_KNIGHT": {"info_key": "rgblight.animations.knight", "value_type": "bool"},
"RGBLIGHT_EFFECT_RAINBOW_MOOD": {"info_key": "rgblight.animations.rainbow_mood", "value_type": "bool"},
"RGBLIGHT_EFFECT_RAINBOW_SWIRL": {"info_key": "rgblight.animations.rainbow_swirl", "value_type": "bool"},
"RGBLIGHT_EFFECT_RGB_TEST": {"info_key": "rgblight.animations.rgb_test", "value_type": "bool"},
"RGBLIGHT_EFFECT_SNAKE": {"info_key": "rgblight.animations.snake", "value_type": "bool"},
"RGBLIGHT_EFFECT_STATIC_GRADIENT": {"info_key": "rgblight.animations.static_gradient", "value_type": "bool"},
"RGBLIGHT_EFFECT_TWINKLE": {"info_key": "rgblight.animations.twinkle"},
"RGBLIGHT_LAYER_BLINK": {"info_key": "rgblight.layers.blink", "value_type": "bool"},
"RGBLIGHT_LAYERS": {"info_key": "rgblight.layers.enabled", "value_type": "bool"},
"RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF": {"info_key": "rgblight.layers.override_rgb", "value_type": "bool"},

View File

@ -264,6 +264,12 @@
"led_matrix": {
"type": "object",
"properties": {
"animations": {
"type": "object",
"additionalProperties": {
"type": "boolean"
}
},
"driver": {"type": "string"},
"center_point": {
"type": "array",
@ -308,6 +314,12 @@
"rgb_matrix": {
"type": "object",
"properties": {
"animations": {
"type": "object",
"additionalProperties": {
"type": "boolean"
}
},
"driver": {"type": "string"},
"center_point": {
"type": "array",

View File

@ -156,6 +156,12 @@ 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):
for animation in led_feature_json.get('animations', {}):
if led_feature_json['animations'][animation]:
config_h_lines.append(generate_define(f'{prefix}{animation.upper()}'))
@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate config.h for.')
@ -186,5 +192,14 @@ def generate_config_h(cli):
if 'split' in kb_info_json:
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_')
if 'rgb_matrix' in kb_info_json:
generate_led_animations_config(kb_info_json['rgb_matrix'], config_h_lines, 'ENABLE_RGB_MATRIX_')
if 'rgblight' in kb_info_json:
generate_led_animations_config(kb_info_json['rgblight'], config_h_lines, 'RGBLIGHT_EFFECT_')
# Show the results
dump_lines(cli.args.output, config_h_lines, cli.args.quiet)