FastLED 3.10.8
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>
virtual void fl::UCS7604ControllerT< DATA_PIN, RGB_ORDER, MODE, CHIPSET_TIMING, CLOCKLESS_CONTROLLER >::showPixels ( PixelController< RGB_ORDER > & pixels)
inlineoverrideprotectedvirtual

Definition at line 137 of file ucs7604.h.

137 {
138 if (pixels.size() == 0) {
139 return;
140 }
141
142 // Get current control values (recalculated each frame)
144
145 // Reorder RGB current values to match the color order (RGB_ORDER template parameter)
146 // The current control values are semantic (current.r controls RED LEDs, etc.)
147 // but need to be sent in wire order matching the pixel data reordering
148 u8 rgb_currents[3] = {current.r, current.g, current.b};
149
150 // Extract channel positions from RGB_ORDER (octal encoding: 0=R, 1=G, 2=B)
151 // Octal digits are read right-to-left in bit positions but left-to-right semantically
152 // RGB (012 octal): wire position 0=R(0), 1=G(1), 2=B(2)
153 // GRB (102 octal): wire position 0=G(1), 1=R(0), 2=B(2)
154 u8 pos0 = (static_cast<int>(RGB_ORDER) >> 6) & 0x3; // Wire position 0 (leftmost octal digit)
155 u8 pos1 = (static_cast<int>(RGB_ORDER) >> 3) & 0x3; // Wire position 1 (middle octal digit)
156 u8 pos2 = (static_cast<int>(RGB_ORDER) >> 0) & 0x3; // Wire position 2 (rightmost octal digit)
157
158 // Reorder: wire R gets current for channel at pos0, etc.
159 u8 r_current = rgb_currents[pos0]; // Wire R (position 0)
160 u8 g_current = rgb_currents[pos1]; // Wire G (position 1)
161 u8 b_current = rgb_currents[pos2]; // Wire B (position 2)
162 u8 w_current = current.w; // W always in position 3
163
164 // Create current control struct with reordered values
166
167 // Get gamma LUT: per-controller override or default 2.8
168 float gamma = mGamma;
170
171 // UCS7604 is always RGBW — override any user setting.
174
175 // Clear buffer and use encoder to fill it
176 mByteBuffer.clear();
178 MODE, wire_current, pixel_iter.get_rgbw().active(), gamma8.get());
179
180 // Reinterpret byte buffer as CRGB pixels (encoder ensures divisible by 3)
181 size_t num_pixels = mByteBuffer.size() / 3;
183
184 // Construct PixelController and send to delegate controller
186 mDelegate.callShowPixels(pixel_data);
187 }
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:108
DelegateController mDelegate
Definition ucs7604.h:103
UCS7604 controller extending CPixelLEDController.
Definition ucs7604.h:91
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