FastLED 3.10.8
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 98 of file slim_spi_bridge_controller.h.

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