MCPcopy Create free account
hub / github.com/FastLED/FastLED / renderLed

Method renderLed

examples/Chromancer/ripple.h:392–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390 byte rippleId; // Used to identify this ripple in debug output
391
392 void renderLed(byte ledColors[40][14][3], unsigned long age) {
393 int strip = ledAssignments[position[0]][0];
394 int led = ledAssignments[position[0]][2] + position[1];
395 FL_UNUSED(strip);
396 FL_UNUSED(led);
397
398 int red = ledColors[position[0]][position[1]][0];
399 int green = ledColors[position[0]][position[1]][1];
400 int blue = ledColors[position[0]][position[1]][2];
401
402 ledColors[position[0]][position[1]][0] = byte(fl::min(255, fl::max(0, int(fmap(float(age), 0.0, float(lifespan), (color >> 8) & 0xFF, 0.0)) + red)));
403 ledColors[position[0]][position[1]][1] = byte(fl::min(255, fl::max(0, int(fmap(float(age), 0.0, float(lifespan), (color >> 16) & 0xFF, 0.0)) + green)));
404 ledColors[position[0]][position[1]][2] = byte(fl::min(255, fl::max(0, int(fmap(float(age), 0.0, float(lifespan), color & 0xFF, 0.0)) + blue)));
405
406#ifdef DEBUG_RENDERING
407 Serial.print("Rendering ripple position (");
408 Serial.print(position[0]);
409 Serial.print(',');
410 Serial.print(position[1]);
411 Serial.print(") at Strip ");
412 Serial.print(strip);
413 Serial.print(", LED ");
414 Serial.print(led);
415 Serial.print(", color 0x");
416 for (int i = 0; i < 3; i++) {
417 if (ledColors[position[0]][position[1]][i] <= 0x0F)
418 Serial.print('0');
419 Serial.print(ledColors[position[0]][position[1]][i], HEX);
420 }
421 Serial.println();
422#endif
423 }
424};
425
426#endif

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
fmapFunction · 0.85
printMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected