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

381 {
383 onBeginFrame();
386
388 // If we have a function for computing power, use it!
389 if(mPPowerFunc) {
390 scale = (*mPPowerFunc)(scale, mNPowerData);
391 }
393
394
395 // A byte index saves bookkeeping on 16-bit-int targets; retain wider limits.
396 using ControllerIndex = fl::conditional_t<
398 ControllerIndex length = 0;
400
401 while(pCur && length < MAX_CLED_CONTROLLERS) {
402 if (pCur->getEnabled()) {
403 gControllersData[length] = pCur->beginShowLeds(pCur->size());
404 } else {
405 gControllersData[length] = nullptr;
406 }
407 length++;
409 pCur = pCur->next();
410 }
411
412 pCur = CLEDController::head();
413 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
414 if (pCur->getEnabled()) {
415 pCur->showLedsInternal(scale);
416 }
417 pCur = pCur->next();
418
419 }
420
421 length = 0; // Reset length to 0 and iterate again.
422 pCur = CLEDController::head();
423 while(pCur && length < MAX_CLED_CONTROLLERS) {
424 if (pCur->getEnabled()) {
425 pCur->endShowLeds(gControllersData[length]);
426 }
427 length++;
428 pCur = pCur->next();
429 }
430 countFPS();
431 onEndFrame();
433}
#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
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: