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