FastLED 3.9.15
Loading...
Searching...
No Matches

◆ show() [2/2]

void CFastLED::show ( uint8_t 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 113 of file FastLED.cpp.

113 {
115 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
116 lastshow = micros();
117
118 // If we have a function for computing power, use it!
119 if(m_pPowerFunc) {
120 scale = (*m_pPowerFunc)(scale, m_nPowerData);
121 }
122
123
124 int length = 0;
125 CLEDController *pCur = CLEDController::head();
126
127 while(pCur && length < MAX_CLED_CONTROLLERS) {
128 if (pCur->getEnabled()) {
129 gControllersData[length] = pCur->beginShowLeds(pCur->size());
130 } else {
131 gControllersData[length] = nullptr;
132 }
133 length++;
134 if (m_nFPS < 100) { pCur->setDither(0); }
135 pCur = pCur->next();
136 }
137
138 pCur = CLEDController::head();
139 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
140 if (pCur->getEnabled()) {
141 pCur->showLedsInternal(scale);
142 }
143 pCur = pCur->next();
144
145 }
146
147 length = 0; // Reset length to 0 and iterate again.
148 pCur = CLEDController::head();
149 while(pCur && length < MAX_CLED_CONTROLLERS) {
150 if (pCur->getEnabled()) {
151 pCur->endShowLeds(gControllersData[length]);
152 }
153 length++;
154 pCur = pCur->next();
155 }
156 countFPS();
157 onEndFrame();
159}
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)
#define MAX_CLED_CONTROLLERS
Definition FastLED.cpp:18
static void * gControllersData[MAX_CLED_CONTROLLERS]
Definition FastLED.cpp:111
static uint32_t lastshow
Definition FastLED.cpp:62
void onEndFrame()
Definition FastLED.cpp:161
uint32_t m_nMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:374
uint16_t m_nFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:373
power_func m_pPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:376
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
Definition FastLED.cpp:334
uint32_t m_nPowerData
max power use parameter
Definition FastLED.h:375
CLEDController * next()
Get the next controller in the linked list after this one.
CLEDController & setDither(uint8_t ditherMode=BINARY_DITHER)
Set the dithering mode for this controller to use.
virtual int size()
How many LEDs does this controller manage?
static CLEDController * head()
Get the first LED controller in the linked list of controllers.
virtual void * beginShowLeds(int size)
static void onBeginFrame()
static void onEndShowLeds()
UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)

References CLEDController::beginShowLeds(), countFPS(), CLEDController::endShowLeds(), gControllersData, CLEDController::getEnabled(), CLEDController::head(), lastshow, length(), m_nFPS, m_nMinMicros, m_nPowerData, m_pPowerFunc, MAX_CLED_CONTROLLERS, CLEDController::next(), fl::EngineEvents::onBeginFrame(), onEndFrame(), fl::EngineEvents::onEndShowLeds(), scale, CLEDController::setDither(), CLEDController::showLedsInternal(), and CLEDController::size().

+ Here is the call graph for this function: