diff options
| author | Joshua Diamond <josh@windowoffire.com> | 2020-06-01 05:02:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-01 11:02:28 +0200 |
| commit | e2e287ec5f720839efd8f7cecf447763433cda27 (patch) | |
| tree | fba21d51c2a44c3c088872ce940c2d0e48b3fa45 /quantum/rgblight.c | |
| parent | dfcd4f0d25bb3db8798ad8bb06da0fab68e7cf25 (diff) | |
| download | qmk_firmware-e2e287ec5f720839efd8f7cecf447763433cda27.tar.gz qmk_firmware-e2e287ec5f720839efd8f7cecf447763433cda27.zip | |
Option to allow lighting layers when RGB Lighting is off (#9051)
Diffstat (limited to 'quantum/rgblight.c')
| -rw-r--r-- | quantum/rgblight.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 73a7afd7b..949dd79fe 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -628,6 +628,13 @@ void rgblight_set_layer_state(uint8_t layer, bool enabled) { | |||
| 628 | if (rgblight_status.timer_enabled == false) { | 628 | if (rgblight_status.timer_enabled == false) { |
| 629 | rgblight_mode_noeeprom(rgblight_config.mode); | 629 | rgblight_mode_noeeprom(rgblight_config.mode); |
| 630 | } | 630 | } |
| 631 | |||
| 632 | # ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF | ||
| 633 | // If not enabled, then nothing else will actually set the LEDs... | ||
| 634 | if (!rgblight_config.enable) { | ||
| 635 | rgblight_set(); | ||
| 636 | } | ||
| 637 | # endif | ||
| 631 | } | 638 | } |
| 632 | 639 | ||
| 633 | bool rgblight_get_layer_state(uint8_t layer) { | 640 | bool rgblight_get_layer_state(uint8_t layer) { |
| @@ -693,16 +700,11 @@ void rgblight_unblink_layers(void) { | |||
| 693 | __attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); } | 700 | __attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); } |
| 694 | 701 | ||
| 695 | #ifndef RGBLIGHT_CUSTOM_DRIVER | 702 | #ifndef RGBLIGHT_CUSTOM_DRIVER |
| 703 | |||
| 696 | void rgblight_set(void) { | 704 | void rgblight_set(void) { |
| 697 | LED_TYPE *start_led; | 705 | LED_TYPE *start_led; |
| 698 | uint8_t num_leds = rgblight_ranges.clipping_num_leds; | 706 | uint8_t num_leds = rgblight_ranges.clipping_num_leds; |
| 699 | 707 | ||
| 700 | # ifdef RGBLIGHT_LAYERS | ||
| 701 | if (rgblight_layers != NULL) { | ||
| 702 | rgblight_layers_write(); | ||
| 703 | } | ||
| 704 | # endif | ||
| 705 | |||
| 706 | if (!rgblight_config.enable) { | 708 | if (!rgblight_config.enable) { |
| 707 | for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) { | 709 | for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) { |
| 708 | led[i].r = 0; | 710 | led[i].r = 0; |
| @@ -714,6 +716,16 @@ void rgblight_set(void) { | |||
| 714 | } | 716 | } |
| 715 | } | 717 | } |
| 716 | 718 | ||
| 719 | # ifdef RGBLIGHT_LAYERS | ||
| 720 | if (rgblight_layers != NULL | ||
| 721 | # ifndef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF | ||
| 722 | && rgblight_config.enable | ||
| 723 | # endif | ||
| 724 | ) { | ||
| 725 | rgblight_layers_write(); | ||
| 726 | } | ||
| 727 | # endif | ||
| 728 | |||
| 717 | # ifdef RGBLIGHT_LED_MAP | 729 | # ifdef RGBLIGHT_LED_MAP |
| 718 | LED_TYPE led0[RGBLED_NUM]; | 730 | LED_TYPE led0[RGBLED_NUM]; |
| 719 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | 731 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { |
