fixed but limiting the sketch to 256 LEDs. (#380)

Updated comments about MAX_LEDS
This commit is contained in:
penfold42 2017-01-28 23:36:31 +11:00 committed by redPanther
parent ed47852518
commit c43c7e3fcd
1 changed files with 11 additions and 6 deletions

View File

@ -13,7 +13,11 @@
#define INITIAL_LED_TEST_BRIGHTNESS 32 // 0..255 #define INITIAL_LED_TEST_BRIGHTNESS 32 // 0..255
// Number of leds in your strip. set to "1" and ANALOG_OUTPUT_ENABLED to "true" to activate analog only // Number of leds in your strip. set to "1" and ANALOG_OUTPUT_ENABLED to "true" to activate analog only
#define MAX_LEDS 100 // As of 26/1/2017:
// 582 leaves ZERO bytes free and this
// 410 is ok
// tested with 500 leds and is fine (despite the warning)
#define MAX_LEDS 500
// type of your led controller, possible values, see below // type of your led controller, possible values, see below
#define LED_TYPE WS2812B #define LED_TYPE WS2812B
@ -55,9 +59,10 @@
#define COLOR_CORRECTION TypicalLEDStrip // predefined fastled color correction #define COLOR_CORRECTION TypicalLEDStrip // predefined fastled color correction
//#define COLOR_CORRECTION CRGB(255,255,255) // or RGB value describing the color correction //#define COLOR_CORRECTION CRGB(255,255,255) // or RGB value describing the color correction
// Baudrate, higher rate allows faster refresh rate and more LEDs // Baudrate, higher rate allows faster refresh rate and more LEDs
#define serialRate 460800 // use 115200 for ftdi based boards //#define serialRate 460800 // use 115200 for ftdi based boards
//#define serialRate 115200 // use 115200 for ftdi based boards #define serialRate 115200 // use 115200 for ftdi based boards
//#define serialRate 500000 // use 115200 for ftdi based boards
/************************************** /**************************************
@ -191,10 +196,10 @@ void setup() {
sum_g = 0; sum_g = 0;
sum_b = 0; sum_b = 0;
int num_leds = (hi<<8) + lo + 1; int num_leds = min ( MAX_LEDS, (hi<<8) + lo + 1 );
// read the transmission data and set LED values // read the transmission data and set LED values
for (uint8_t idx = 0; idx < min(num_leds,MAX_LEDS); idx++) { for (int idx = 0; idx < num_leds; idx++) {
byte r, g, b; byte r, g, b;
if (!checkIncommingData()) { if (!checkIncommingData()) {
transmissionSuccess = false; transmissionSuccess = false;