AP_Notify: allow up to 64 LEDs on a pin

This commit is contained in:
Andrew Tridgell 2020-02-09 21:35:25 +11:00
parent bde8a6e11b
commit 65c172bbb6
2 changed files with 4 additions and 3 deletions

View File

@ -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++) { for (uint16_t chan=0; chan<16; chan++) {
if ((1U<<chan) & enable_mask) { if ((1U<<chan) & enable_mask) {
hal.rcout->set_neopixel_rgb_data(chan, (1U<<HAL_NEOPIXEL_COUNT)-1, red, green, blue); hal.rcout->set_neopixel_rgb_data(chan, -1, red, green, blue);
} }
} }
hal.rcout->neopixel_send(); hal.rcout->neopixel_send();

View File

@ -39,7 +39,8 @@ SITL_SFML_LED::SITL_SFML_LED():
void SITL_SFML_LED::update_serial_LEDs() void SITL_SFML_LED::update_serial_LEDs()
{ {
static sf::RenderWindow *w; 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(); SITL::SITL *sitl = AP::sitl();
if (sitl == nullptr || sitl->led.send_counter == 0) { 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++) { for (uint8_t i=0; i<16; i++) {
max_leds = MAX(max_leds, sitl->led.num_leds[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) { if (!w) {
return; return;
} }