FastLED 3.10.10
Loading...
Searching...
No Matches

◆ showPixels()

template<int DATA_PIN, EOrder RGB_ORDER, fl::UCS7604Mode MODE, typename CHIPSET_TIMING, template< int, typename, EOrder > class CLOCKLESS_CONTROLLER, typename DELEGATE = CLOCKLESS_CONTROLLER<DATA_PIN, CHIPSET_TIMING, RGB>>
virtual void fl::UCS7604ControllerT< DATA_PIN, RGB_ORDER, MODE, CHIPSET_TIMING, CLOCKLESS_CONTROLLER, DELEGATE >::showPixels ( PixelController< RGB_ORDER > & pixels)
inlineoverrideprotectedvirtual

Definition at line 144 of file ucs7604.h.

144 {
145 if (pixels.size() == 0) {
146 return;
147 }
148
149 // Get current control values (recalculated each frame)
151
152 // Reorder RGB current values to match the color order (RGB_ORDER template parameter)
153 // The current control values are semantic (current.r controls RED LEDs, etc.)
154 // but need to be sent in wire order matching the pixel data reordering
155 u8 rgb_currents[3] = {current.r, current.g, current.b};
156
157 // Extract channel positions from RGB_ORDER (octal encoding: 0=R, 1=G, 2=B)
158 // Octal digits are read right-to-left in bit positions but left-to-right semantically
159 // RGB (012 octal): wire position 0=R(0), 1=G(1), 2=B(2)
160 // GRB (102 octal): wire position 0=G(1), 1=R(0), 2=B(2)
161 u8 pos0 = (static_cast<int>(RGB_ORDER) >> 6) & 0x3; // Wire position 0 (leftmost octal digit)
162 u8 pos1 = (static_cast<int>(RGB_ORDER) >> 3) & 0x3; // Wire position 1 (middle octal digit)
163 u8 pos2 = (static_cast<int>(RGB_ORDER) >> 0) & 0x3; // Wire position 2 (rightmost octal digit)
164
165 // Reorder: wire R gets current for channel at pos0, etc.
166 u8 r_current = rgb_currents[pos0]; // Wire R (position 0)
167 u8 g_current = rgb_currents[pos1]; // Wire G (position 1)
168 u8 b_current = rgb_currents[pos2]; // Wire B (position 2)
169 u8 w_current = current.w; // W always in position 3
170
171 // Create current control struct with reordered values
173
174 // Get gamma LUT: per-controller override or default 2.8
175 float gamma = mGamma;
177
178 // UCS7604 is always RGBW — override any user setting.
181
182 // Clear buffer and use encoder to fill it
183 mByteBuffer.clear();
185 MODE, wire_current, pixel_iter.get_rgbw().active(), gamma8.get());
186
187 // Reinterpret byte buffer as CRGB pixels (encoder ensures divisible by 3)
188 size_t num_pixels = mByteBuffer.size() / 3;
190
191 // Construct PixelController and send to delegate controller
193 mDelegate.callShowPixels(pixel_data);
194 }
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
static fl::shared_ptr< const Gamma8 > getOrCreate(float gamma) FL_NO_EXCEPT
Definition ease.cpp.hpp:460
fl::vector_psram< u8 > mByteBuffer
Definition ucs7604.h:110
DelegateController mDelegate
Definition ucs7604.h:105
UCS7604 controller extending CPixelLEDController.
Definition ucs7604.h:93
CurrentControl brightness() FL_NO_EXCEPT
Get current global UCS7604 brightness value.
To bit_cast(const From &from) FL_NO_EXCEPT
Definition bit_cast.h:48
void encodeUCS7604(PixelIterator &pixel_iter, size_t num_leds, OutputIterator out, UCS7604Mode mode, const UCS7604CurrentControl &current, bool is_rgbw, const Gamma8 *gamma=nullptr, bool wide_source=false) FL_NO_EXCEPT
Encode complete UCS7604 frame (preamble + padding + pixel data)
Definition ucs7604.h:273
static Rgbw value() FL_NO_EXCEPT
Definition rgbw.h:290