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

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: