fix rainbow animation

This commit is contained in:
2026-01-06 21:55:00 +01:00
parent 0f62418d93
commit 883fff95dd

View File

@ -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);
if (i < num_leds_a)
{
led_set_pixel_a(num_leds_a - i - 1, color);
} }
else
for (uint16_t i = 0; i < num_leds_b; i++)
{ {
hsv_t hsv = {(uint8_t)(global_hue + (i * 7)), 255, 255}; led_set_pixel_b(i - num_leds_a, color);
led_set_pixel_b(i, led_hsv_to_rgb(hsv)); }
} }
} }
@ -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();