AP_SerialLED: added define for LED limit

This commit is contained in:
Andrew Tridgell 2020-02-12 14:05:30 +11:00
parent 5ad4ceef71
commit 2277e22bc7
2 changed files with 5 additions and 1 deletions

View File

@ -30,7 +30,7 @@ AP_SerialLED::AP_SerialLED()
// set number of LEDs per pin
bool AP_SerialLED::set_num_LEDs(uint8_t chan, uint8_t num_leds)
{
if (chan >= 1 && chan <= 16 && num_leds <= 64) {
if (chan >= 1 && chan <= 16 && num_leds <= AP_SERIALLED_MAX_LEDS) {
return hal.rcout->set_neopixel_num_LEDs(chan-1, num_leds);
}
return false;

View File

@ -19,6 +19,10 @@
#include <AP_HAL/AP_HAL.h>
// limit number of LEDs, mostly to keep DMA memory consumption within
// reasonable bounds
#define AP_SERIALLED_MAX_LEDS 64
class AP_SerialLED {
public:
AP_SerialLED();