FastLED 3.10.10
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 461 of file FastLED.cpp.hpp.

461 {
462 onBeginFrame();
465
467 // If we have a function for computing power, use it!
468 if(mPPowerFunc) {
469 // showColor() encodes a constant, not controller source pixels; the
470 // source-frame managed prepass cannot model it.
471#if FL_COLOR_PIPELINE_SHARED
472 const fl::FramePowerDispatch* dispatch = fl::activeFramePowerDispatch();
473 scale = dispatch ? dispatch->showColorBrightness(scale, mNPowerData)
474 : (*mPPowerFunc)(scale, mNPowerData);
475#else
476 scale = (*mPPowerFunc)(scale, mNPowerData);
477#endif
478 }
480
481 int length = 0;
483 while(pCur && length < MAX_CLED_CONTROLLERS) {
484 if (pCur->getEnabled()) {
485 gControllersData[length] = pCur->beginShowLeds(pCur->size());
486 } else {
487 gControllersData[length] = nullptr;
488 }
489 length++;
490 pCur = pCur->next();
491 }
492
493 pCur = CLEDController::head();
494 while(pCur && length < MAX_CLED_CONTROLLERS) {
496 if (pCur->getEnabled()) {
497 pCur->showColorInternal(color, scale);
498 }
499 pCur = pCur->next();
500 }
501
502 pCur = CLEDController::head();
503 length = 0; // Reset length to 0 and iterate again.
504 while(pCur && length < MAX_CLED_CONTROLLERS) {
505 if (pCur->getEnabled()) {
507 }
508 length++;
509 pCur = pCur->next();
510 }
511 countFPS();
512 onEndFrame();
514}
#define MAX_CLED_CONTROLLERS
static fl::u32 lastshow
static void * gControllersData[MAX_CLED_CONTROLLERS]
static void throttleToMaxRefreshRate(fl::u32 minMicros) FL_NO_EXCEPT
#define FL_DITHER_ENABLE_MIN_REFRESH_HZ
High level controller interface for FastLED.
Definition FastLED.h:714
fl::UISlider scale("Scale", 4,.1, 4,.1)
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:728
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:727
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:725
fl::u8 mLastShownScale
brightness the last show()/showColor() applied, after the power limiter
Definition FastLED.h:730
fl::u8 mLastRequestedScale
brightness the last show()/showColor() was asked for
Definition FastLED.h:729
fl::u16 mMaxRefreshHz
frame-rate cap in Hz, 0 = unlimited (u16 saves 2 B over micros, #4788)
Definition FastLED.h:726
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)
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: