Padded single digit LED identifiers to two chars (01,02 vs 1,2 etc)
This commit is contained in:
parent
7a059a1a14
commit
d5befdb3eb
1 changed files with 20 additions and 14 deletions
|
@ -74,7 +74,7 @@ void handleSetSingleLED(uint8_t * mypayload, uint8_t firstChar = 1) {
|
|||
strncpy ( templed, (const char *) &mypayload[firstChar], 2 );
|
||||
uint8_t led = atoi(templed);
|
||||
|
||||
if (led < strip.numPixels()) {
|
||||
if (led <= strip.numPixels()) {
|
||||
ledstates[led].red = ((rgb >> 16) & 0xFF);
|
||||
ledstates[led].green = ((rgb >> 8) & 0xFF);
|
||||
ledstates[led].blue = ((rgb >> 0) & 0xFF);
|
||||
|
@ -118,8 +118,14 @@ void handleRangeDifferentColors(uint8_t * mypayload) {
|
|||
|
||||
while ( rangebegin <= rangeend ) {
|
||||
char rangeData[9] = { 0,0,0,0,0,0,0,0,0 };
|
||||
if ( rangebegin < 10 ) {
|
||||
//Create the valid 'nextCommand' structure
|
||||
sprintf(rangeData, "0%d%s", rangebegin, colorval);
|
||||
}
|
||||
if ( rangebegin >= 10 ) {
|
||||
//Create the valid 'nextCommand' structure
|
||||
sprintf(rangeData, "%d%s", rangebegin, colorval);
|
||||
}
|
||||
//Set one LED
|
||||
handleSetSingleLED((uint8_t*) rangeData, 0);
|
||||
rangebegin++;
|
||||
|
|
Loading…
Reference in a new issue