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 119 of file FastLED.cpp.

119 {
121 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
122 lastshow = micros();
123
124 // If we have a function for computing power, use it!
125 if(m_pPowerFunc) {
126 scale = (*m_pPowerFunc)(scale, m_nPowerData);
127 }
128
129
130 int length = 0;
131 CLEDController *pCur = CLEDController::head();
132
133 while(pCur && length < MAX_CLED_CONTROLLERS) {
134 if (pCur->getEnabled()) {
135 gControllersData[length] = pCur->beginShowLeds(pCur->size());
136 } else {
137 gControllersData[length] = nullptr;
138 }
139 length++;
140 if (m_nFPS < 100) { pCur->setDither(0); }
141 pCur = pCur->next();
142 }
143
144 pCur = CLEDController::head();
145 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
146 if (pCur->getEnabled()) {
147 pCur->showLedsInternal(scale);
148 }
149 pCur = pCur->next();
150
151 }
152
153 length = 0; // Reset length to 0 and iterate again.
154 pCur = CLEDController::head();
155 while(pCur && length < MAX_CLED_CONTROLLERS) {
156 if (pCur->getEnabled()) {
157 pCur->endShowLeds(gControllersData[length]);
158 }
159 length++;
160 pCur = pCur->next();
161 }
162 countFPS();
163 onEndFrame();
165}
#define MAX_CLED_CONTROLLERS
Definition FastLED.cpp:19
static void * gControllersData[MAX_CLED_CONTROLLERS]
Definition FastLED.cpp:117
static uint32_t lastshow
Definition FastLED.cpp:68
void onEndFrame()
Definition FastLED.cpp:167
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:340
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)
uint16_t scale
Definition funky.cpp:83

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: