FastLED 3.9.15
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 315 of file FastLED.cpp.hpp.

315 {
316 while(mNMinMicros && ((fl::micros()-lastshow) < mNMinMicros)) {
317#if SKETCH_HAS_LARGE_MEMORY
319#endif
320 }
322
323 // If we have a function for computing power, use it!
324 if(mPPowerFunc) {
325 scale = (*mPPowerFunc)(scale, mNPowerData);
326 }
327
328 int length = 0;
330 while(pCur && length < MAX_CLED_CONTROLLERS) {
331 if (pCur->getEnabled()) {
332 gControllersData[length] = pCur->beginShowLeds(pCur->size());
333 } else {
334 gControllersData[length] = nullptr;
335 }
336 length++;
337 pCur = pCur->next();
338 }
339
340 pCur = CLEDController::head();
341 while(pCur && length < MAX_CLED_CONTROLLERS) {
342 if(mNFPS < 100) { pCur->setDither(0); }
343 if (pCur->getEnabled()) {
344 pCur->showColorInternal(color, scale);
345 }
346 pCur = pCur->next();
347 }
348
349 pCur = CLEDController::head();
350 length = 0; // Reset length to 0 and iterate again.
351 while(pCur && length < MAX_CLED_CONTROLLERS) {
352 if (pCur->getEnabled()) {
354 }
355 length++;
356 pCur = pCur->next();
357 }
358 countFPS();
359 onEndFrame();
360}
#define MAX_CLED_CONTROLLERS
static fl::u32 lastshow
static void * gControllersData[MAX_CLED_CONTROLLERS]
fl::UISlider scale("Scale", 4,.1, 4,.1)
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:616
void onEndFrame()
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
fl::u32 mNPowerData
max power use parameter
Definition FastLED.h:615
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:613
fl::u32 mNMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:614
virtual void * beginShowLeds(int size) FL_NOEXCEPT
virtual void endShowLeds(void *data) FL_NOEXCEPT
CLEDController & setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NOEXCEPT
Set the dithering mode for this controller to use.
CLEDController * next() FL_NOEXCEPT
Get the next controller in the linked list after this one.
virtual int size() const FL_NOEXCEPT
How many LEDs does this controller manage?
static CLEDController * head() FL_NOEXCEPT
Get the first LED controller in the linked list of controllers.
bool getEnabled() FL_NOEXCEPT
void showColorInternal(const CRGB &data, int nLeds, fl::u8 brightness) FL_NOEXCEPT
fl::CLEDController CLEDController
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
void run(fl::u32 microseconds, ExecFlags flags)
Run selected task subsystems.
fl::u32 micros()
Universal microsecond timer - returns microseconds since system startup.

References fl::CLEDController::beginShowLeds(), countFPS(), fl::CLEDController::endShowLeds(), gControllersData, fl::CLEDController::getEnabled(), fl::CLEDController::head(), lastshow, length(), MAX_CLED_CONTROLLERS, fl::micros(), mNFPS, mNMinMicros, mNPowerData, mPPowerFunc, fl::CLEDController::next(), onEndFrame(), fl::task::run(), scale, fl::CLEDController::setDither(), fl::CLEDController::showColorInternal(), fl::CLEDController::size(), and fl::task::SYSTEM.

Referenced by clear().

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