FastLED 3.10.6
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 133 of file slim_bridge_controller.h.

133 {
135
136 // (A1) Respect runtime driver enable/disable: ChannelManager is the
137 // single source of truth. A disabled driver means "drop this frame",
138 // not "enqueue and hope" -- silently enqueuing to a disabled driver
139 // is the #2517 silent-drop failure mode.
140 if (!Policy::enabled(driver)) {
141 FL_WARN_ONCE("SlimBridgeController: driver '" << driver.getName().c_str() << "' is disabled - dropping frame");
142 return;
143 }
144
145 // (A8) If the previous frame's buffer is still in flight, block
146 // (bounded) until the driver reports it can accept more work rather
147 // than racing the driver's in-progress DMA/RMT transfer.
148 if (mData->isInUse()) {
149 if (!driver.waitForReady()) {
150 FL_WARN_ONCE("SlimBridgeController: driver '" << driver.getName().c_str() << "' did not become ready in time - dropping frame");
151 return;
152 }
153 }
154
155 // Give subclasses a chance to observe the accepted frame before it is
156 // encoded (e.g. feeding ActiveStripTracker for stub/WASM channels).
158
159 // (A5) Publish the pixel byte layout so the driver (and any
160 // downstream padding/diagnostic code) knows the encoded stride.
161 if (this->getRgbww().active()) {
162 mData->setPixelFormat(ChannelPixelFormat::RGBWW);
163 } else if (this->getRgbw().active()) {
164 mData->setPixelFormat(ChannelPixelFormat::RGBW);
165 } else {
166 mData->setPixelFormat(ChannelPixelFormat::RGB);
167 }
168
169 // (A3) Re-encode into the same buffer every frame -- clear() keeps
170 // capacity, so steady-state operation is allocation-free.
171 mData->getData().clear();
173 iterator.writeWS2812(&mData->getData());
174
175 driver.enqueue(mData);
177 }
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:442

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: