diff options
author | Ryan <fauxpark@gmail.com> | 2021-02-17 02:51:28 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 10:51:28 -0500 |
commit | 53b96f685d3399e1281747b11a1194178089706c (patch) | |
tree | bac3e0e884e5778b2fbab893fab2d31e17ab5aaa /quantum | |
parent | 02b5bb9b17f90d0b741b3b7128e61ac747ab4d6c (diff) | |
download | qmk_firmware-53b96f685d3399e1281747b11a1194178089706c.tar.gz qmk_firmware-53b96f685d3399e1281747b11a1194178089706c.zip |
RGBLight: Allow configurable default settings (#11912)
* RGBLight: Allow configurable default settings
* Docs
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/rgblight.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 7d7d015ba..904c02d6c 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
@@ -84,6 +84,26 @@ static uint8_t mode_base_table[] = { | |||
84 | #include "rgblight_modes.h" | 84 | #include "rgblight_modes.h" |
85 | }; | 85 | }; |
86 | 86 | ||
87 | #if !defined(RGBLIGHT_DEFAULT_MODE) | ||
88 | # define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT | ||
89 | #endif | ||
90 | |||
91 | #if !defined(RGBLIGHT_DEFAULT_HUE) | ||
92 | # define RGBLIGHT_DEFAULT_HUE 0 | ||
93 | #endif | ||
94 | |||
95 | #if !defined(RGBLIGHT_DEFAULT_SAT) | ||
96 | # define RGBLIGHT_DEFAULT_SAT UINT8_MAX | ||
97 | #endif | ||
98 | |||
99 | #if !defined(RGBLIGHT_DEFAULT_VAL) | ||
100 | # define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL | ||
101 | #endif | ||
102 | |||
103 | #if !defined(RGBLIGHT_DEFAULT_SPD) | ||
104 | # define RGBLIGHT_DEFAULT_SPD 0 | ||
105 | #endif | ||
106 | |||
87 | static inline int is_static_effect(uint8_t mode) { return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; } | 107 | static inline int is_static_effect(uint8_t mode) { return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; } |
88 | 108 | ||
89 | #ifdef RGBLIGHT_LED_MAP | 109 | #ifdef RGBLIGHT_LED_MAP |
@@ -183,11 +203,11 @@ void eeconfig_update_rgblight_current(void) { eeconfig_update_rgblight(rgblight_ | |||
183 | 203 | ||
184 | void eeconfig_update_rgblight_default(void) { | 204 | void eeconfig_update_rgblight_default(void) { |
185 | rgblight_config.enable = 1; | 205 | rgblight_config.enable = 1; |
186 | rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; | 206 | rgblight_config.mode = RGBLIGHT_DEFAULT_MODE; |
187 | rgblight_config.hue = 0; | 207 | rgblight_config.hue = RGBLIGHT_DEFAULT_HUE; |
188 | rgblight_config.sat = UINT8_MAX; | 208 | rgblight_config.sat = RGBLIGHT_DEFAULT_SAT; |
189 | rgblight_config.val = RGBLIGHT_LIMIT_VAL; | 209 | rgblight_config.val = RGBLIGHT_DEFAULT_VAL; |
190 | rgblight_config.speed = 0; | 210 | rgblight_config.speed = RGBLIGHT_DEFAULT_SPD; |
191 | RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; | 211 | RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; |
192 | eeconfig_update_rgblight(rgblight_config.raw); | 212 | eeconfig_update_rgblight(rgblight_config.raw); |
193 | } | 213 | } |