FastLED 3.10.8
Loading...
Searching...
No Matches

◆ showPixels()

template<int DATA_PIN, typename TIMING, EOrder RGB_ORDER, int WAIT_TIME, typename DriverTraits, int XTRA0 = 0, bool DIRECT_SHOW = (FL_SLIM_BRIDGE_DIRECT_SHOW != 0)>
void fl::SlimBridgeController< DATA_PIN, TIMING, RGB_ORDER, WAIT_TIME, DriverTraits, XTRA0, DIRECT_SHOW >::showPixels ( PixelController< RGB_ORDER > & pixels)
inlineoverrideprotected

Definition at line 136 of file slim_bridge_controller.h.

136 {
138
139 // (A1) Respect runtime driver enable/disable: ChannelManager is the
140 // single source of truth. A disabled driver means "drop this frame",
141 // not "enqueue and hope" -- silently enqueuing to a disabled driver
142 // is the #2517 silent-drop failure mode.
143 if (!Policy::enabled(driver)) {
144 FL_WARN_ONCE("SlimBridgeController: driver '" << driver.getName().c_str() << "' is disabled - dropping frame");
145 return;
146 }
147
148 // (A8) If the previous frame's buffer is still in flight, block
149 // (bounded) until the driver reports it can accept more work rather
150 // than racing the driver's in-progress DMA/RMT transfer.
151 if (mData->isInUse()) {
152 if (!driver.waitForReady()) {
153 FL_WARN_ONCE("SlimBridgeController: driver '" << driver.getName().c_str() << "' did not become ready in time - dropping frame");
154 return;
155 }
156 }
157
158 // Give subclasses a chance to observe the accepted frame before it is
159 // encoded (e.g. feeding ActiveStripTracker for stub/WASM channels).
161
162 // (A5) Publish the pixel byte layout so the driver (and any
163 // downstream padding/diagnostic code) knows the encoded stride.
164 if (this->getRgbww().active()) {
165 mData->setPixelFormat(ChannelPixelFormat::RGBWW);
166 } else if (this->getRgbw().active()) {
167 mData->setPixelFormat(ChannelPixelFormat::RGBW);
168 } else {
169 mData->setPixelFormat(ChannelPixelFormat::RGB);
170 }
171
172 // (A3) Re-encode into the same buffer every frame -- clear() keeps
173 // capacity, so steady-state operation is allocation-free.
174 mData->getData().clear();
176 iterator.writeWS2812(&mData->getData());
177
178 driver.enqueue(mData);
180 }
Rgbww getRgbww() const FL_NO_EXCEPT
Rgbw getRgbw() const FL_NO_EXCEPT
virtual void onBeforeEncode(PixelController< RGB_ORDER > &pixels) FL_NO_EXCEPT
Called once per accepted frame, after the enabled/ready gates pass and BEFORE the frame is encoded an...
Shared legacy addLeds<>() bridge controller over an IChannelDriver.
#define FL_WARN_ONCE(...)
Definition log.h:439

References fl::basic_string::c_str(), fl::IChannelDriver::enqueue(), fl::FL_NO_EXCEPT, FL_WARN_ONCE, fl::IChannelDriver::getName(), fl::CLEDController::getRgbw(), fl::CLEDController::getRgbww(), mData, onBeforeEncode(), fl::RGB, fl::RGBW, fl::RGBWW, and fl::IChannelDriver::waitForReady().

+ Here is the call graph for this function: