From 5796b28e1a32afb8c9b4816d13b28b1e118b41d5 Mon Sep 17 00:00:00 2001 From: localhorst Date: Tue, 6 Jan 2026 23:02:54 +0100 Subject: [PATCH] improve navigation animation --- main/animation.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/main/animation.c b/main/animation.c index 8b0e0e8..9e2e8bf 100644 --- a/main/animation.c +++ b/main/animation.c @@ -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)