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

◆ showColor() [2/2]

void CFastLED::showColor ( const struct CRGB & color,
uint8_t scale )

Set all leds on all controllers to the given color/scale.

Parameters
colorwhat color to set the leds to
scalewhat brightness scale to show at

Definition at line 187 of file FastLED.cpp.

187 {
188 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
189 lastshow = micros();
190
191 // If we have a function for computing power, use it!
192 if(m_pPowerFunc) {
193 scale = (*m_pPowerFunc)(scale, m_nPowerData);
194 }
195
196 int length = 0;
197 CLEDController *pCur = CLEDController::head();
198 while(pCur && length < MAX_CLED_CONTROLLERS) {
199 if (pCur->getEnabled()) {
200 gControllersData[length] = pCur->beginShowLeds(pCur->size());
201 } else {
202 gControllersData[length] = nullptr;
203 }
204 length++;
205 pCur = pCur->next();
206 }
207
208 pCur = CLEDController::head();
209 while(pCur && length < MAX_CLED_CONTROLLERS) {
210 if(m_nFPS < 100) { pCur->setDither(0); }
211 if (pCur->getEnabled()) {
212 pCur->showColorInternal(color, scale);
213 }
214 pCur = pCur->next();
215 }
216
217 pCur = CLEDController::head();
218 length = 0; // Reset length to 0 and iterate again.
219 while(pCur && length < MAX_CLED_CONTROLLERS) {
220 if (pCur->getEnabled()) {
222 }
223 length++;
224 pCur = pCur->next();
225 }
226 countFPS();
227 onEndFrame();
228}
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 void endShowLeds(void *data)
virtual int size()
How many LEDs does this controller manage?
static CLEDController * head()
Get the first LED controller in the linked list of controllers.
void showColorInternal(const struct CRGB &data, int nLeds, uint8_t brightness)
virtual void * beginShowLeds(int size)
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(), onEndFrame(), scale, CLEDController::setDither(), CLEDController::showColorInternal(), and CLEDController::size().

Referenced by clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: