Remove unnecessary loop from handleSetSingleLED()
This commit is contained in:
parent
d5befdb3eb
commit
a38e386577
1 changed files with 2 additions and 5 deletions
|
@ -73,17 +73,14 @@ void handleSetSingleLED(uint8_t * mypayload, uint8_t firstChar = 1) {
|
||||||
char templed[3];
|
char templed[3];
|
||||||
strncpy ( templed, (const char *) &mypayload[firstChar], 2 );
|
strncpy ( templed, (const char *) &mypayload[firstChar], 2 );
|
||||||
uint8_t led = atoi(templed);
|
uint8_t led = atoi(templed);
|
||||||
|
|
||||||
if (led <= strip.numPixels()) {
|
if (led <= strip.numPixels()) {
|
||||||
ledstates[led].red = ((rgb >> 16) & 0xFF);
|
ledstates[led].red = ((rgb >> 16) & 0xFF);
|
||||||
ledstates[led].green = ((rgb >> 8) & 0xFF);
|
ledstates[led].green = ((rgb >> 8) & 0xFF);
|
||||||
ledstates[led].blue = ((rgb >> 0) & 0xFF);
|
ledstates[led].blue = ((rgb >> 0) & 0xFF);
|
||||||
DBG_OUTPUT_PORT.printf("WS: Set single led [%u] to [%u] [%u] [%u] (%s)!\n", led, ledstates[led].red, ledstates[led].green, ledstates[led].blue, mypayload);
|
DBG_OUTPUT_PORT.printf("WS: Set single led [%u] to [%u] [%u] [%u] (%s)!\n", led, ledstates[led].red, ledstates[led].green, ledstates[led].blue, mypayload);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < strip.numPixels(); i++) {
|
strip.setPixelColor(led, ledstates[led].red, ledstates[led].green, ledstates[led].blue);
|
||||||
strip.setPixelColor(i, ledstates[i].red, ledstates[i].green, ledstates[i].blue);
|
|
||||||
//DBG_OUTPUT_PORT.printf("[%u]--[%u] [%u] [%u] [%u] LED index!\n", rgb, i, ledstates[i].red, ledstates[i].green, ledstates[i].blue);
|
|
||||||
}
|
|
||||||
strip.show();
|
strip.show();
|
||||||
}
|
}
|
||||||
exit_func = true;
|
exit_func = true;
|
||||||
|
|
Loading…
Reference in a new issue