forked from mirrors/qmk_userspace
Retain brightness with lighting layers (#13025)
Add guard `RGBLIGHT_LAYERS_RETAIN_VAL` to retain the currently used val when applying lighting layers.
This commit is contained in:
parent
85128302c8
commit
fb9a254a43
2 changed files with 11 additions and 0 deletions
|
@ -694,6 +694,9 @@ bool rgblight_get_layer_state(uint8_t layer) {
|
|||
|
||||
// Write any enabled LED layers into the buffer
|
||||
static void rgblight_layers_write(void) {
|
||||
# ifdef RGBLIGHT_LAYERS_RETAIN_VAL
|
||||
uint8_t current_val = rgblight_get_val();
|
||||
# endif
|
||||
uint8_t i = 0;
|
||||
// For each layer
|
||||
for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) {
|
||||
|
@ -714,7 +717,11 @@ static void rgblight_layers_write(void) {
|
|||
// Write segment.count LEDs
|
||||
LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)];
|
||||
for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) {
|
||||
# ifdef RGBLIGHT_LAYERS_RETAIN_VAL
|
||||
sethsv(segment.hue, segment.sat, current_val, led_ptr);
|
||||
# else
|
||||
sethsv(segment.hue, segment.sat, segment.val, led_ptr);
|
||||
# endif
|
||||
}
|
||||
segment_ptr++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue