FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

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

193 {
194 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
195 lastshow = micros();
196
197 // If we have a function for computing power, use it!
198 if(m_pPowerFunc) {
199 scale = (*m_pPowerFunc)(scale, m_nPowerData);
200 }
201
202 int length = 0;
203 CLEDController *pCur = CLEDController::head();
204 while(pCur && length < MAX_CLED_CONTROLLERS) {
205 if (pCur->getEnabled()) {
206 gControllersData[length] = pCur->beginShowLeds(pCur->size());
207 } else {
208 gControllersData[length] = nullptr;
209 }
210 length++;
211 pCur = pCur->next();
212 }
213
214 pCur = CLEDController::head();
215 while(pCur && length < MAX_CLED_CONTROLLERS) {
216 if(m_nFPS < 100) { pCur->setDither(0); }
217 if (pCur->getEnabled()) {
218 pCur->showColorInternal(color, scale);
219 }
220 pCur = pCur->next();
221 }
222
223 pCur = CLEDController::head();
224 length = 0; // Reset length to 0 and iterate again.
225 while(pCur && length < MAX_CLED_CONTROLLERS) {
226 if (pCur->getEnabled()) {
228 }
229 length++;
230 pCur = pCur->next();
231 }
232 countFPS();
233 onEndFrame();
234}
#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 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)
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(), 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: