RGBLight: Allow configurable default settings (#11912)

* RGBLight: Allow configurable default settings

* Docs
This commit is contained in:
Ryan 2021-02-17 02:51:28 +11:00 committed by GitHub
parent 02b5bb9b17
commit 53b96f685d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 14 deletions

View file

@ -82,15 +82,20 @@ Changing the **Value** sets the overall brightness.<br>
Your RGB lighting can be configured by placing these `#define`s in your `config.h`:
|Define |Default |Description |
|---------------------|-------------|-----------------------------------------------------------------------------|
|`RGBLIGHT_HUE_STEP` |`10` |The number of steps to cycle through the hue by |
|`RGBLIGHT_SAT_STEP` |`17` |The number of steps to increment the saturation by |
|`RGBLIGHT_VAL_STEP` |`17` |The number of steps to increment the brightness by |
|`RGBLIGHT_LIMIT_VAL` |`255` |The maximum brightness level |
|`RGBLIGHT_SLEEP` |*Not defined*|If defined, the RGB lighting will be switched off when the host goes to sleep|
|`RGBLIGHT_SPLIT` |*Not defined*|If defined, synchronization functionality for split keyboards is added|
|`RGBLIGHT_DISABLE_KEYCODES`|*not defined*|If defined, disables the ability to control RGB Light from the keycodes. You must use code functions to control the feature|
|Define |Default |Description |
|---------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------------|
|`RGBLIGHT_HUE_STEP` |`10` |The number of steps to cycle through the hue by |
|`RGBLIGHT_SAT_STEP` |`17` |The number of steps to increment the saturation by |
|`RGBLIGHT_VAL_STEP` |`17` |The number of steps to increment the brightness by |
|`RGBLIGHT_LIMIT_VAL` |`255` |The maximum brightness level |
|`RGBLIGHT_SLEEP` |*Not defined* |If defined, the RGB lighting will be switched off when the host goes to sleep |
|`RGBLIGHT_SPLIT` |*Not defined* |If defined, synchronization functionality for split keyboards is added |
|`RGBLIGHT_DISABLE_KEYCODES`|*Not defined* |If defined, disables the ability to control RGB Light from the keycodes. You must use code functions to control the feature|
|`RGBLIGHT_DEFAULT_MODE` |`RGBLIGHT_MODE_STATIC_LIGHT`|The default mode to use upon clearing the EEPROM |
|`RGBLIGHT_DEFAULT_HUE` |`0` (red) |The default hue to use upon clearing the EEPROM |
|`RGBLIGHT_DEFAULT_SAT` |`UINT8_MAX` (255) |The default saturation to use upon clearing the EEPROM |
|`RGBLIGHT_DEFAULT_VAL` |`RGBLIGHT_LIMIT_VAL` |The default value (brightness) to use upon clearing the EEPROM |
|`RGBLIGHT_DEFAULT_SPD` |`0` |The default speed to use upon clearing the EEPROM |
## Effects and Animations

View file

@ -84,6 +84,26 @@ static uint8_t mode_base_table[] = {
#include "rgblight_modes.h"
};
#if !defined(RGBLIGHT_DEFAULT_MODE)
# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT
#endif
#if !defined(RGBLIGHT_DEFAULT_HUE)
# define RGBLIGHT_DEFAULT_HUE 0
#endif
#if !defined(RGBLIGHT_DEFAULT_SAT)
# define RGBLIGHT_DEFAULT_SAT UINT8_MAX
#endif
#if !defined(RGBLIGHT_DEFAULT_VAL)
# define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL
#endif
#if !defined(RGBLIGHT_DEFAULT_SPD)
# define RGBLIGHT_DEFAULT_SPD 0
#endif
static inline int is_static_effect(uint8_t mode) { return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; }
#ifdef RGBLIGHT_LED_MAP
@ -183,11 +203,11 @@ void eeconfig_update_rgblight_current(void) { eeconfig_update_rgblight(rgblight_
void eeconfig_update_rgblight_default(void) {
rgblight_config.enable = 1;
rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT;
rgblight_config.hue = 0;
rgblight_config.sat = UINT8_MAX;
rgblight_config.val = RGBLIGHT_LIMIT_VAL;
rgblight_config.speed = 0;
rgblight_config.mode = RGBLIGHT_DEFAULT_MODE;
rgblight_config.hue = RGBLIGHT_DEFAULT_HUE;
rgblight_config.sat = RGBLIGHT_DEFAULT_SAT;
rgblight_config.val = RGBLIGHT_DEFAULT_VAL;
rgblight_config.speed = RGBLIGHT_DEFAULT_SPD;
RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS;
eeconfig_update_rgblight(rgblight_config.raw);
}