Implement data driven lighting defaults (#21825)
parent
a19ae3d784
commit
fbbb221a31
|
@ -29,6 +29,9 @@
|
|||
"BACKLIGHT_PIN": {"info_key": "backlight.pin"},
|
||||
"BACKLIGHT_PINS": {"info_key": "backlight.pins", "value_type": "array"},
|
||||
"BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"},
|
||||
"BACKLIGHT_DEFAULT_ON": {"info_key": "backlight.default.on", "value_type": "bool"},
|
||||
"BACKLIGHT_DEFAULT_BREATHING": {"info_key": "backlight.default.breathing", "value_type": "bool"},
|
||||
"BACKLIGHT_DEFAULT_LEVEL": {"info_key": "backlight.default.brightness", "value_type": "int"},
|
||||
|
||||
// Bootmagic
|
||||
"BOOTMAGIC_LITE_COLUMN": {"info_key": "bootmagic.matrix.1", "value_type": "int"},
|
||||
|
@ -82,6 +85,9 @@
|
|||
"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},
|
||||
"LED_MATRIX_DEFAULT_ON": {"info_key": "led_matrix.default.on", "value_type": "bool"},
|
||||
"LED_MATRIX_DEFAULT_VAL": {"info_key": "led_matrix.default.val", "value_type": "int"},
|
||||
"LED_MATRIX_DEFAULT_SPD": {"info_key": "led_matrix.default.speed", "value_type": "int"},
|
||||
|
||||
// Locking Switch
|
||||
"LOCKING_SUPPORT_ENABLE": {"info_key": "qmk.locking.enabled", "value_type": "bool"},
|
||||
|
@ -129,6 +135,11 @@
|
|||
"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},
|
||||
"RGB_MATRIX_DEFAULT_ON": {"info_key": "rgb_matrix.default.on", "value_type": "bool"},
|
||||
"RGB_MATRIX_DEFAULT_HUE": {"info_key": "rgb_matrix.default.hue", "value_type": "int"},
|
||||
"RGB_MATRIX_DEFAULT_SAT": {"info_key": "rgb_matrix.default.sat", "value_type": "int"},
|
||||
"RGB_MATRIX_DEFAULT_VAL": {"info_key": "rgb_matrix.default.val", "value_type": "int"},
|
||||
"RGB_MATRIX_DEFAULT_SPD": {"info_key": "rgb_matrix.default.speed", "value_type": "int"},
|
||||
|
||||
// RGBLight
|
||||
"RGBLED_NUM": {"info_key": "rgblight.led_count", "value_type": "int"},
|
||||
|
@ -144,6 +155,11 @@
|
|||
"RGBLIGHT_SLEEP": {"info_key": "rgblight.sleep", "value_type": "bool"},
|
||||
"RGBLIGHT_SPLIT": {"info_key": "rgblight.split", "value_type": "bool"},
|
||||
"RGBLIGHT_VAL_STEP": {"info_key": "rgblight.brightness_steps", "value_type": "int"},
|
||||
"RGBLIGHT_DEFAULT_ON": {"info_key": "rgblight.default.on", "value_type": "bool"},
|
||||
"RGBLIGHT_DEFAULT_HUE": {"info_key": "rgblight.default.hue", "value_type": "int"},
|
||||
"RGBLIGHT_DEFAULT_SAT": {"info_key": "rgblight.default.sat", "value_type": "int"},
|
||||
"RGBLIGHT_DEFAULT_VAL": {"info_key": "rgblight.default.val", "value_type": "int"},
|
||||
"RGBLIGHT_DEFAULT_SPD": {"info_key": "rgblight.default.speed", "value_type": "int"},
|
||||
"RGBW": {"info_key": "rgblight.rgbw", "value_type": "bool"},
|
||||
|
||||
// Secure
|
||||
|
|
|
@ -136,6 +136,15 @@
|
|||
"type": "string",
|
||||
"enum": ["pwm", "software", "timer", "custom"]
|
||||
},
|
||||
"default": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"on": {"type": "boolean"},
|
||||
"breathing": {"type": "boolean"},
|
||||
"brightness": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}
|
||||
}
|
||||
},
|
||||
"breathing": {"type": "boolean"},
|
||||
"breathing_period": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"levels": {
|
||||
|
@ -418,6 +427,16 @@
|
|||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"on": {"type": "boolean"},
|
||||
"animation": {"type": "string"},
|
||||
"val": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"speed": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}
|
||||
}
|
||||
},
|
||||
"driver": {"type": "string"},
|
||||
"center_point": {
|
||||
"type": "array",
|
||||
|
@ -472,6 +491,18 @@
|
|||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"on": {"type": "boolean"},
|
||||
"animation": {"type": "string"},
|
||||
"hue": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"sat": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"val": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"speed": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}
|
||||
}
|
||||
},
|
||||
"driver": {"type": "string"},
|
||||
"center_point": {
|
||||
"type": "array",
|
||||
|
@ -530,6 +561,18 @@
|
|||
}
|
||||
},
|
||||
"brightness_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"default": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"on": {"type": "boolean"},
|
||||
"animation": {"type": "string"},
|
||||
"hue": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"sat": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"val": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"speed": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}
|
||||
}
|
||||
},
|
||||
"driver": {
|
||||
"type": "string",
|
||||
"enum": ["apa102", "custom", "ws2812"]
|
||||
|
|
|
@ -134,6 +134,16 @@ Configures the [Backlight](feature_backlight.md) feature.
|
|||
* `breathing_period`
|
||||
* The length of one backlight breathing cycle in seconds.
|
||||
* Default: `6` (6 seconds)
|
||||
* `default`
|
||||
* `on`
|
||||
* The default backlight enabled state.
|
||||
* Default: `true`
|
||||
* `breathing`
|
||||
* The default backlight breathing state.
|
||||
* Default: `false`
|
||||
* `brightness`
|
||||
* The default brightness level.
|
||||
* Default: `max_brightness`
|
||||
* `driver`
|
||||
* The driver to use. Must be one of `custom`, `pwm`, `software`, `timer`.
|
||||
* Default: `"pwm"`
|
||||
|
@ -341,7 +351,7 @@ Configures the [LED Matrix](feature_led_matrix.md) feature.
|
|||
* Example:
|
||||
```json
|
||||
{
|
||||
"alpha_mods": true,
|
||||
"alphas_mods": true,
|
||||
"breathing": true,
|
||||
"cycle_left_right": false
|
||||
}
|
||||
|
@ -349,6 +359,19 @@ Configures the [LED Matrix](feature_led_matrix.md) feature.
|
|||
* `center_point`
|
||||
* The centroid (geometric center) of the LEDs. Used for certain effects.
|
||||
* Default: `[112, 32]`
|
||||
* `default`
|
||||
* `animation`
|
||||
* The default effect. Must be one of `led_matrix.animations`
|
||||
* Default: `"solid"`
|
||||
* `on`
|
||||
* The default enabled state.
|
||||
* Default: `true`
|
||||
* `val`
|
||||
* The default brightness level.
|
||||
* Default: `max_brightness`
|
||||
* `speed`
|
||||
* The default animation speed.
|
||||
* Default: `128`
|
||||
* `driver` (Required)
|
||||
* The driver to use. Must be one of `custom`, `is31fl3218`, `is31fl3731`, `is31fl3733`, `is31fl3736`, `is31fl3737`, `is31fl3741`, `is31fl3742a`, `is31fl3743a`, `is31fl3745`, `is31fl3746a`, `snled27351`.
|
||||
* `layout` (Required)
|
||||
|
@ -506,6 +529,25 @@ Configures the [RGB Lighting](feature_rgblight.md) feature.
|
|||
* `brightness_steps`
|
||||
* The number of brightness adjustment steps.
|
||||
* Default: `17`
|
||||
* `default`
|
||||
* `animation`
|
||||
* The default effect. Must be one of `rgblight.animations`
|
||||
* Default: `"static_light"`
|
||||
* `on`
|
||||
* The default enabled state.
|
||||
* Default: `true`
|
||||
* `hue`
|
||||
* The default hue value.
|
||||
* Default: `0`
|
||||
* `sat`
|
||||
* The default saturation value.
|
||||
* Default: `255`
|
||||
* `val`
|
||||
* The default brightness level.
|
||||
* Default: `max_brightness`
|
||||
* `speed`
|
||||
* The default animation speed.
|
||||
* Default: `0`
|
||||
* `driver`
|
||||
* The driver to use. Must be one of `apa102`, `custom`, `ws2812`.
|
||||
* Default: `"ws2812"`
|
||||
|
@ -554,7 +596,7 @@ Configures the [RGB Matrix](feature_rgb_matrix.md) feature.
|
|||
* Example:
|
||||
```json
|
||||
{
|
||||
"alpha_mods": true,
|
||||
"alphas_mods": true,
|
||||
"breathing": true,
|
||||
"cycle_left_right": false
|
||||
}
|
||||
|
@ -562,6 +604,25 @@ Configures the [RGB Matrix](feature_rgb_matrix.md) feature.
|
|||
* `center_point`
|
||||
* The centroid (geometric center) of the LEDs. Used for certain effects.
|
||||
* Default: `[112, 32]`
|
||||
* `default`
|
||||
* `animation`
|
||||
* The default effect. Must be one of `rgb_matrix.animations`
|
||||
* Default: `"solid_color"`
|
||||
* `on`
|
||||
* The default enabled state.
|
||||
* Default: `true`
|
||||
* `hue`
|
||||
* The default hue value.
|
||||
* Default: `0`
|
||||
* `sat`
|
||||
* The default saturation value.
|
||||
* Default: `255`
|
||||
* `val`
|
||||
* The default brightness level.
|
||||
* Default: `max_brightness`
|
||||
* `speed`
|
||||
* The default animation speed.
|
||||
* Default: `128`
|
||||
* `driver` (Required)
|
||||
* The driver to use. Must be one of `aw20216s`, `custom`, `is31fl3218`, `is31fl3731`, `is31fl3733`, `is31fl3736`, `is31fl3737`, `is31fl3741`, `is31fl3742a`, `is31fl3743a`, `is31fl3745`, `is31fl3746a`, `snled27351`, `ws2812`.
|
||||
* `hue_steps`
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue