|
|
|
@ -1209,14 +1209,13 @@ typedef struct PACKED {
|
|
|
|
|
static TwinkleState led_twinkle_state[RGBLED_NUM];
|
|
|
|
|
|
|
|
|
|
void rgblight_effect_twinkle(animation_status_t *anim) {
|
|
|
|
|
|
|
|
|
|
bool random_color = anim->delta / 3;
|
|
|
|
|
bool restart = anim->pos == 0;
|
|
|
|
|
anim->pos = 1;
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
|
|
|
|
TwinkleState *t = &(led_twinkle_state[i]);
|
|
|
|
|
HSV *c = &(t->hsv);
|
|
|
|
|
HSV * c = &(t->hsv);
|
|
|
|
|
if (restart) {
|
|
|
|
|
// Restart
|
|
|
|
|
t->life = 0;
|
|
|
|
@ -1225,7 +1224,7 @@ void rgblight_effect_twinkle(animation_status_t *anim) {
|
|
|
|
|
// This LED is already on, either brightening or dimming
|
|
|
|
|
t->life--;
|
|
|
|
|
uint8_t on = t->up ? RGBLIGHT_EFFECT_TWINKLE_LIFE - t->life : t->life;
|
|
|
|
|
c->v = (uint16_t) rgblight_config.val * on / RGBLIGHT_EFFECT_TWINKLE_LIFE;
|
|
|
|
|
c->v = (uint16_t)rgblight_config.val * on / RGBLIGHT_EFFECT_TWINKLE_LIFE;
|
|
|
|
|
if (t->life == 0 && t->up) {
|
|
|
|
|
t->up = false;
|
|
|
|
|
t->life = RGBLIGHT_EFFECT_TWINKLE_LIFE;
|
|
|
|
|