FastLED 3.9.15
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

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

234 {
236 onBeginFrame();
237 while(mNMinMicros && ((fl::micros()-lastshow) < mNMinMicros)) {
238#if SKETCH_HAS_LARGE_MEMORY
240#endif
241 }
243
244 // If we have a function for computing power, use it!
245 if(mPPowerFunc) {
246 scale = (*mPPowerFunc)(scale, mNPowerData);
247 }
248
249
250 int length = 0;
252
253 while(pCur && length < MAX_CLED_CONTROLLERS) {
254 if (pCur->getEnabled()) {
255 gControllersData[length] = pCur->beginShowLeds(pCur->size());
256 } else {
257 gControllersData[length] = nullptr;
258 }
259 length++;
260 if (mNFPS < 100) { pCur->setDither(0); }
261 pCur = pCur->next();
262 }
263
264 pCur = CLEDController::head();
265 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
266 if (pCur->getEnabled()) {
267 pCur->showLedsInternal(scale);
268 }
269 pCur = pCur->next();
270
271 }
272
273 length = 0; // Reset length to 0 and iterate again.
274 pCur = CLEDController::head();
275 while(pCur && length < MAX_CLED_CONTROLLERS) {
276 if (pCur->getEnabled()) {
277 pCur->endShowLeds(gControllersData[length]);
278 }
279 length++;
280 pCur = pCur->next();
281 }
282 countFPS();
283 onEndFrame();
285}
#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 onEndShowLeds()
Manually trigger the end show LEDs event.
void onBeginFrame()
Manually trigger the begin frame event.
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
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
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.
#define FL_SCOPED_TRACE
Definition trace.h:128

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

+ Here is the call graph for this function: