improve navigation animation
This commit is contained in:
@ -183,7 +183,12 @@ static void anim_sinelon(void)
|
||||
|
||||
static void anim_navigation(void)
|
||||
{
|
||||
// Navigation lights: left red, right green
|
||||
// Aviation navigation lights with strobe overlay:
|
||||
// - Red: Port (left) wingtip - steady
|
||||
// - Green: Starboard (right) wingtip - steady
|
||||
// - White strobe: Overlays outer nav lights with bright flashes
|
||||
|
||||
static uint8_t strobe_counter = 0;
|
||||
led_clear_all();
|
||||
|
||||
uint16_t num_leds_a = led_get_num_leds_a();
|
||||
@ -191,22 +196,34 @@ static void anim_navigation(void)
|
||||
|
||||
rgb_t red = {255, 0, 0};
|
||||
rgb_t green = {0, 255, 0};
|
||||
rgb_t white = {255, 255, 255};
|
||||
|
||||
// Side red (last 3 LEDs of strip A)
|
||||
// Anti-collision strobe pattern: Double flash at ~1 Hz
|
||||
// Flash duration: 3 frames (~50ms) for high-intensity effect
|
||||
bool first_flash = (strobe_counter < 3);
|
||||
bool second_flash = (strobe_counter >= 7 && strobe_counter < 10);
|
||||
bool strobe_active = (first_flash || second_flash);
|
||||
|
||||
// Port (left) - Red navigation light OR white strobe (outer 3 LEDs of strip A)
|
||||
if (num_leds_a >= 3)
|
||||
{
|
||||
led_set_pixel_a(num_leds_a - 1, red);
|
||||
rgb_t color_a = strobe_active ? white : red;
|
||||
led_set_pixel_a(num_leds_a - 1, color_a);
|
||||
led_set_pixel_a(num_leds_a - 2, red);
|
||||
led_set_pixel_a(num_leds_a - 3, red);
|
||||
}
|
||||
|
||||
// Side green (last 3 LEDs of strip B)
|
||||
// Starboard (right) - Green navigation light OR white strobe (outer 3 LEDs of strip B)
|
||||
if (num_leds_b >= 3)
|
||||
{
|
||||
led_set_pixel_b(num_leds_b - 1, green);
|
||||
rgb_t color_b = strobe_active ? white : green;
|
||||
led_set_pixel_b(num_leds_b - 1, color_b);
|
||||
led_set_pixel_b(num_leds_b - 2, green);
|
||||
led_set_pixel_b(num_leds_b - 3, green);
|
||||
}
|
||||
|
||||
// Strobe cycle: 90 frames = 1.5 second at 60 FPS
|
||||
strobe_counter = (strobe_counter + 1) % 90;
|
||||
}
|
||||
|
||||
static void anim_chase(void)
|
||||
|
||||
Reference in New Issue
Block a user