FastLED 3.10.8
Loading...
Searching...
No Matches

◆ showColor() [2/2]

void CFastLED::showColor ( const CRGB & color,
fl::u8 scale )

Set all leds on all controllers to the given color/scale.

Parameters
colorwhat color to set the leds to
scalewhat brightness scale to show at

Definition at line 453 of file FastLED.cpp.hpp.

453 {
454 onBeginFrame();
457
459 // If we have a function for computing power, use it!
460 if(mPPowerFunc) {
461 // showColor() encodes a constant, not controller source pixels; the
462 // source-frame managed prepass cannot model it.
463#if FL_COLOR_PIPELINE_SHARED
464 const fl::FramePowerDispatch* dispatch = fl::activeFramePowerDispatch();
465 scale = dispatch ? dispatch->showColorBrightness(scale, mNPowerData)
466 : (*mPPowerFunc)(scale, mNPowerData);
467#else
468 scale = (*mPPowerFunc)(scale, mNPowerData);
469#endif
470 }
472
473 int length = 0;
475 while(pCur && length < MAX_CLED_CONTROLLERS) {
476 if (pCur->getEnabled()) {
477 gControllersData[length] = pCur->beginShowLeds(pCur->size());
478 } else {
479 gControllersData[length] = nullptr;
480 }
481 length++;
482 pCur = pCur->next();
483 }
484
485 pCur = CLEDController::head();
486 while(pCur && length < MAX_CLED_CONTROLLERS) {
488 if (pCur->getEnabled()) {
489 pCur->showColorInternal(color, scale);
490 }
491 pCur = pCur->next();
492 }
493
494 pCur = CLEDController::head();
495 length = 0; // Reset length to 0 and iterate again.
496 while(pCur && length < MAX_CLED_CONTROLLERS) {
497 if (pCur->getEnabled()) {
499 }
500 length++;
501 pCur = pCur->next();
502 }
503 countFPS();
504 onEndFrame();
506}
#define MAX_CLED_CONTROLLERS
static fl::u32 lastshow
static void * gControllersData[MAX_CLED_CONTROLLERS]
static void throttleToMaxRefreshRate(fl::u32 minMicros) FL_NO_EXCEPT
fl::UISlider scale("Scale", 4,.1, 4,.1)
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:731
void countFPS(int nFrames=25) FL_NO_EXCEPT
For debugging, this will keep track of time between calls to countFPS().
void onEndShowLeds() FL_NO_EXCEPT
Manually trigger the end show LEDs event.
void onBeginFrame() FL_NO_EXCEPT
Manually trigger the begin frame event.
void onEndFrame() FL_NO_EXCEPT
fl::u32 mNPowerData
max power use parameter
Definition FastLED.h:730
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:728
fl::u8 mLastShownScale
brightness the last show()/showColor() applied, after the power limiter
Definition FastLED.h:733
fl::u8 mLastRequestedScale
brightness the last show()/showColor() was asked for
Definition FastLED.h:732
fl::u16 mMaxRefreshHz
frame-rate cap in Hz, 0 = unlimited (u16 saves 2 B over micros, #4788)
Definition FastLED.h:729
void showColorInternal(const CRGB &data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT
static CLEDController * head() FL_NO_EXCEPT
Get the first LED controller in the linked list of controllers.
bool getEnabled() FL_NO_EXCEPT
VIRTUAL_IF_NOT_AVR void * beginShowLeds(int size) FL_NO_EXCEPT
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
VIRTUAL_IF_NOT_AVR void endShowLeds(void *data) FL_NO_EXCEPT
CLEDController & setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NO_EXCEPT
Set the dithering mode for this controller to use.
CLEDController * next() FL_NO_EXCEPT
Get the next controller in the linked list after this one.
fl::CLEDController CLEDController
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
#define FL_DITHER_ENABLE_MIN_REFRESH_HZ
High level controller interface for FastLED.
Definition FastLED.h:717
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.

References fl::CLEDController::beginShowLeds(), countFPS(), fl::CLEDController::endShowLeds(), FL_DITHER_ENABLE_MIN_REFRESH_HZ, FL_NO_EXCEPT, gControllersData, fl::CLEDController::getEnabled(), fl::CLEDController::head(), lastshow, length(), MAX_CLED_CONTROLLERS, fl::micros(), mLastRequestedScale, mLastShownScale, mMaxRefreshHz, mNFPS, mNPowerData, mPPowerFunc, fl::CLEDController::next(), onBeginFrame(), onEndFrame(), onEndShowLeds(), scale, fl::CLEDController::setDither(), fl::CLEDController::showColorInternal(), fl::CLEDController::size(), and throttleToMaxRefreshRate().

Referenced by clear(), and showColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: