FastLED 3.10.9
Loading...
Searching...
No Matches

◆ show() [2/2]

FL_KEEP_ALIVE void CFastLED::show ( fl::u8 scale)

Update all our controllers with the current led colors, using the passed in brightness.

Parameters
scalethe brightness value to use in place of the stored value
Warning
This function is not interrupt-safe and must not be called from an interrupt service routine (ISR). On ESP32, doing so can deadlock or trigger an interrupt-watchdog panic. Have the ISR set a flag, then call show() from loop() or a normal task after leaving the interrupt context.

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

377 {
379 onBeginFrame();
382
384 // If we have a function for computing power, use it!
385 if(mPPowerFunc) {
386 scale = (*mPPowerFunc)(scale, mNPowerData);
387 }
389
390
391 // A byte index saves bookkeeping on 16-bit-int targets; retain wider limits.
392 using ControllerIndex = fl::conditional_t<
394 ControllerIndex length = 0;
396
397 while(pCur && length < MAX_CLED_CONTROLLERS) {
398 if (pCur->getEnabled()) {
399 gControllersData[length] = pCur->beginShowLeds(pCur->size());
400 } else {
401 gControllersData[length] = nullptr;
402 }
403 length++;
405 pCur = pCur->next();
406 }
407
408 pCur = CLEDController::head();
409 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
410 if (pCur->getEnabled()) {
411 pCur->showLedsInternal(scale);
412 }
413 pCur = pCur->next();
414
415 }
416
417 length = 0; // Reset length to 0 and iterate again.
418 pCur = CLEDController::head();
419 while(pCur && length < MAX_CLED_CONTROLLERS) {
420 if (pCur->getEnabled()) {
421 pCur->endShowLeds(gControllersData[length]);
422 }
423 length++;
424 pCur = pCur->next();
425 }
426 countFPS();
427 onEndFrame();
429}
#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:712
fl::UISlider scale("Scale", 4,.1, 4,.1)
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:726
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:725
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:723
fl::u8 mLastShownScale
brightness the last show()/showColor() applied, after the power limiter
Definition FastLED.h:728
fl::u8 mLastRequestedScale
brightness the last show()/showColor() was asked for
Definition FastLED.h:727
fl::u16 mMaxRefreshHz
frame-rate cap in Hz, 0 = unlimited (u16 saves 2 B over micros, #4788)
Definition FastLED.h:724
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?
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)
typename conditional< B, T, F >::type conditional_t
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
#define FL_SCOPED_TRACE
Definition trace.h:128

References fl::CLEDController::beginShowLeds(), countFPS(), fl::CLEDController::endShowLeds(), FL_DITHER_ENABLE_MIN_REFRESH_HZ, FL_KEEP_ALIVE, FL_NO_EXCEPT, FL_SCOPED_TRACE, 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::showLedsInternal(), fl::CLEDController::size(), and throttleToMaxRefreshRate().

+ Here is the call graph for this function: