mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-18 13:42:00 +00:00
Changed to rgblight_sethsv_eeprom_helper() for easier reading.
This commit is contained in:
parent
b61004e63e
commit
7ea859371a
@ -572,8 +572,9 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool
|
|||||||
else if (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) {
|
else if (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) {
|
||||||
// static gradient
|
// static gradient
|
||||||
uint16_t _hue;
|
uint16_t _hue;
|
||||||
int8_t direction = ((rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) % 2) ? -1 : 1;
|
uint8_t delta = rgblight_config.mode - rgblight_status.base_mode;
|
||||||
uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - RGBLIGHT_MODE_STATIC_GRADIENT) / 2]);
|
int8_t direction = (delta % 2) ? -1 : 1;
|
||||||
|
uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]);
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
_hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360;
|
_hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360;
|
||||||
dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range);
|
dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range);
|
||||||
@ -583,11 +584,13 @@ void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef RGBLIGHT_SPLIT
|
||||||
if( rgblight_config.hue != hue ||
|
if( rgblight_config.hue != hue ||
|
||||||
rgblight_config.sat != sat ||
|
rgblight_config.sat != sat ||
|
||||||
rgblight_config.val != val ) {
|
rgblight_config.val != val ) {
|
||||||
RGBLIGHT_SPLIT_SET_CHANGE_HSVS;
|
RGBLIGHT_SPLIT_SET_CHANGE_HSVS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
rgblight_config.hue = hue;
|
rgblight_config.hue = hue;
|
||||||
rgblight_config.sat = sat;
|
rgblight_config.sat = sat;
|
||||||
rgblight_config.val = val;
|
rgblight_config.val = val;
|
||||||
|
Loading…
Reference in New Issue
Block a user