From 65c172bbb66c1fcc3031d47a92b6887f8ca44404 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Feb 2020 21:35:25 +1100 Subject: [PATCH] AP_Notify: allow up to 64 LEDs on a pin --- libraries/AP_Notify/NeoPixel.cpp | 2 +- libraries/AP_Notify/SITL_SFML_LED.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Notify/NeoPixel.cpp b/libraries/AP_Notify/NeoPixel.cpp index 024f2b77b3..77caa9dbc6 100644 --- a/libraries/AP_Notify/NeoPixel.cpp +++ b/libraries/AP_Notify/NeoPixel.cpp @@ -89,7 +89,7 @@ bool NeoPixel::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) for (uint16_t chan=0; chan<16; chan++) { if ((1U<set_neopixel_rgb_data(chan, (1U<set_neopixel_rgb_data(chan, -1, red, green, blue); } } hal.rcout->neopixel_send(); diff --git a/libraries/AP_Notify/SITL_SFML_LED.cpp b/libraries/AP_Notify/SITL_SFML_LED.cpp index 045a82d1d2..aa00721642 100644 --- a/libraries/AP_Notify/SITL_SFML_LED.cpp +++ b/libraries/AP_Notify/SITL_SFML_LED.cpp @@ -39,7 +39,8 @@ SITL_SFML_LED::SITL_SFML_LED(): void SITL_SFML_LED::update_serial_LEDs() { static sf::RenderWindow *w; - static sf::RectangleShape *leds[16][32]; + const uint8_t MAX_LEDS = 64; + static sf::RectangleShape *leds[16][MAX_LEDS]; SITL::SITL *sitl = AP::sitl(); if (sitl == nullptr || sitl->led.send_counter == 0) { @@ -51,7 +52,7 @@ void SITL_SFML_LED::update_serial_LEDs() for (uint8_t i=0; i<16; i++) { max_leds = MAX(max_leds, sitl->led.num_leds[i]); } - w = new sf::RenderWindow(sf::VideoMode(32*(serialLED_size+1), 16*(serialLED_size+1)), "SerialLED"); + w = new sf::RenderWindow(sf::VideoMode(MAX_LEDS*(serialLED_size+1), 16*(serialLED_size+1)), "SerialLED"); if (!w) { return; }