fix rainbow animation
This commit is contained in:
@ -102,17 +102,21 @@ static void anim_rainbow(void)
|
|||||||
// Rainbow generator
|
// Rainbow generator
|
||||||
uint16_t num_leds_a = led_get_num_leds_a();
|
uint16_t num_leds_a = led_get_num_leds_a();
|
||||||
uint16_t num_leds_b = led_get_num_leds_b();
|
uint16_t num_leds_b = led_get_num_leds_b();
|
||||||
|
uint16_t num_leds = num_leds_a + num_leds_b;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < num_leds_a; i++)
|
for (uint16_t i = 0; i < num_leds; i++)
|
||||||
{
|
{
|
||||||
hsv_t hsv = {(uint8_t)(global_hue + (i * 7)), 255, 255};
|
hsv_t hsv = {(uint8_t)(global_hue + (i * 7)), 255, 255};
|
||||||
led_set_pixel_a(i, led_hsv_to_rgb(hsv));
|
rgb_t color = led_hsv_to_rgb(hsv);
|
||||||
}
|
|
||||||
|
|
||||||
for (uint16_t i = 0; i < num_leds_b; i++)
|
if (i < num_leds_a)
|
||||||
{
|
{
|
||||||
hsv_t hsv = {(uint8_t)(global_hue + (i * 7)), 255, 255};
|
led_set_pixel_a(num_leds_a - i - 1, color);
|
||||||
led_set_pixel_b(i, led_hsv_to_rgb(hsv));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
led_set_pixel_b(i - num_leds_a, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +383,7 @@ void animation_update(void)
|
|||||||
anim_white();
|
anim_white();
|
||||||
break;
|
break;
|
||||||
case ANIM_RAINBOW:
|
case ANIM_RAINBOW:
|
||||||
// anim_rainbow();
|
anim_rainbow();
|
||||||
break;
|
break;
|
||||||
case ANIM_RAINBOW_GLITTER:
|
case ANIM_RAINBOW_GLITTER:
|
||||||
// anim_rainbow_glitter();
|
// anim_rainbow_glitter();
|
||||||
|
|||||||
Reference in New Issue
Block a user