FastLED 3.10.9
Loading...
Searching...
No Matches

◆ showPixels()

template<fl::SpiChipset CHIPSET, EOrder RGB_ORDER, fl::Bus B, fl::u8 B_WHICH>
void fl::SlimSpiBridgeController< CHIPSET, RGB_ORDER, B, B_WHICH >::showPixels ( PixelController< RGB_ORDER > & pixels)
inlineoverrideprotected

Definition at line 115 of file slim_spi_bridge_controller.h.

115 {
117 if (!driver) {
118 return;
119 }
120
121 // (A1) Respect runtime driver enable/disable: ChannelManager is the
122 // single source of truth. A disabled driver means "drop this frame",
123 // not "enqueue and hope" -- silently enqueuing to a disabled driver
124 // is the #2517 silent-drop failure mode.
126 FL_WARN_ONCE("SlimSpiBridgeController: driver '" << driver->getName() << "' is disabled - dropping frame");
127 return;
128 }
129
130 // (A8) If the previous frame's buffer is still in flight, block
131 // (bounded) until the driver reports it can accept more work rather
132 // than racing the driver's in-progress transfer.
133 if (mData->isInUse()) {
134 if (!driver->waitForReady()) {
135 FL_WARN_ONCE("SlimSpiBridgeController: driver '" << driver->getName() << "' did not become ready in time - dropping frame");
136 return;
137 }
138 }
139
140 // (A5) Publish the pixel byte layout so the driver (and any
141 // downstream padding/diagnostic code) knows the encoded stride.
142 if (this->getRgbww().active()) {
143 mData->setPixelFormat(ChannelPixelFormat::RGBWW);
144 } else if (this->getRgbw().active()) {
145 mData->setPixelFormat(ChannelPixelFormat::RGBW);
146 } else {
147 mData->setPixelFormat(ChannelPixelFormat::RGB);
148 }
149
150 // Dither reseed mirrors Channel::encodeFrame(): only reseed when a
151 // non-zero dither mode is set.
152 if (pixels.ditherActive()) {
153 pixels.reseed_binary_dithering(mDitherPhase);
154 }
155
156 // (A3) Re-encode into the same buffer every frame -- clear() keeps
157 // capacity, so steady-state operation is allocation-free.
158 mData->getData().clear();
159 fl::PixelIterator it(&pixels, this->getRgbw(), this->getRgbww());
160 encode(it, mData->getData());
161
162 driver->enqueue(mData);
163 // Presented, per the driver contract: an accepted enqueue is the
164 // frame -- mirrors Channel::submitFrame()'s ++mDitherPhase placement
165 // (dither only advances when a frame is actually handed to the
166 // driver, not on every showPixels() attempt).
167 ++mDitherPhase;
168 }
Rgbww getRgbww() const FL_NO_EXCEPT
Rgbw getRgbw() const FL_NO_EXCEPT
static void encode(fl::PixelIterator &it, fl::vector_psram< u8 > &out) FL_NO_EXCEPT
Encode it into out using the writer selected by CHIPSET.
fl::shared_ptr< IChannelDriver > resolveDriver() FL_NO_EXCEPT
Resolve the driver for this frame.
Shared legacy addLeds<ESPIChipsets ...>() bridge controller over an IChannelDriver,...
#define FL_WARN_ONCE(...)
Definition log.h:439

References encode(), fl::FL_NO_EXCEPT, FL_WARN_ONCE, fl::CLEDController::getRgbw(), fl::CLEDController::getRgbww(), mData, mDitherPhase, fl::ChannelManager::registry(), resolveDriver(), fl::RGB, fl::RGBW, and fl::RGBWW.

+ Here is the call graph for this function: