Browse Source

AP_Notify: allow up to 64 LEDs on a pin

c415-sdk
Andrew Tridgell 5 years ago
parent
commit
dbba89a024
  1. 2
      libraries/AP_Notify/NeoPixel.cpp
  2. 5
      libraries/AP_Notify/SITL_SFML_LED.cpp

2
libraries/AP_Notify/NeoPixel.cpp

@ -85,7 +85,7 @@ bool NeoPixel::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) @@ -85,7 +85,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<<chan) & enable_mask) {
hal.rcout->set_neopixel_rgb_data(chan, (1U<<(pNotify->get_neo_len()))-1, red, green, blue);
hal.rcout->set_neopixel_rgb_data(chan, -1, red, green, blue);
}
}
hal.rcout->neopixel_send();

5
libraries/AP_Notify/SITL_SFML_LED.cpp

@ -39,7 +39,8 @@ SITL_SFML_LED::SITL_SFML_LED(): @@ -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() @@ -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;
}

Loading…
Cancel
Save