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

107 {
109 while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros));
110 lastshow = micros();
111
112 // If we have a function for computing power, use it!
113 if(m_pPowerFunc) {
114 scale = (*m_pPowerFunc)(scale, m_nPowerData);
115 }
116
117 // static uninitialized gControllersData produces the smallest binary on attiny85.
118 int length = 0;
119 CLEDController *pCur = CLEDController::head();
120
121 while(pCur && length < MAX_CLED_CONTROLLERS) {
122 if (pCur->getEnabled()) {
123 gControllersData[length] = pCur->beginShowLeds(pCur->size());
124 } else {
125 gControllersData[length] = nullptr;
126 }
127 length++;
128 if (m_nFPS < 100) { pCur->setDither(0); }
129 pCur = pCur->next();
130 }
131
132 pCur = CLEDController::head();
133 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
134 if (pCur->getEnabled()) {
135 pCur->showLedsInternal(scale);
136 }
137 pCur = pCur->next();
138
139 }
140
141 length = 0; // Reset length to 0 and iterate again.
142 pCur = CLEDController::head();
143 while(pCur && length < MAX_CLED_CONTROLLERS) {
144 if (pCur->getEnabled()) {
145 pCur->endShowLeds(gControllersData[length]);
146 }
147 length++;
148 pCur = pCur->next();
149 }
150 countFPS();
153}
#define MAX_CLED_CONTROLLERS
Definition FastLED.cpp:18
static void * gControllersData[MAX_CLED_CONTROLLERS]
Definition FastLED.cpp:105
static uint32_t lastshow
Definition FastLED.cpp:62
UISlider scale("Scale", 4,.1, 4,.1)
uint32_t m_nMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:357
uint16_t m_nFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:356
power_func m_pPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:359
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
Definition FastLED.cpp:323
uint32_t m_nPowerData
max power use parameter
Definition FastLED.h:358
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 onEndFrame()
static void onEndShowLeds()

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

+ Here is the call graph for this function: