FastLED 3.10.8
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 373 of file FastLED.cpp.hpp.

373 {
375 onBeginFrame();
378
380 // If we have a function for computing power, use it!
381 if(mPPowerFunc) {
382 scale = (*mPPowerFunc)(scale, mNPowerData);
383 }
385
386
387 // A byte index saves bookkeeping on 16-bit-int targets; retain wider limits.
388 using ControllerIndex = fl::conditional_t<
390 ControllerIndex length = 0;
392
393 while(pCur && length < MAX_CLED_CONTROLLERS) {
394 if (pCur->getEnabled()) {
395 gControllersData[length] = pCur->beginShowLeds(pCur->size());
396 } else {
397 gControllersData[length] = nullptr;
398 }
399 length++;
401 pCur = pCur->next();
402 }
403
404 pCur = CLEDController::head();
405 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
406 if (pCur->getEnabled()) {
407 pCur->showLedsInternal(scale);
408 }
409 pCur = pCur->next();
410
411 }
412
413 length = 0; // Reset length to 0 and iterate again.
414 pCur = CLEDController::head();
415 while(pCur && length < MAX_CLED_CONTROLLERS) {
416 if (pCur->getEnabled()) {
417 pCur->endShowLeds(gControllersData[length]);
418 }
419 length++;
420 pCur = pCur->next();
421 }
422 countFPS();
423 onEndFrame();
425}
#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
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)
#define FL_DITHER_ENABLE_MIN_REFRESH_HZ
High level controller interface for FastLED.
Definition FastLED.h:717
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: