FastLED 3.9.15
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 133 of file ucs7604.h.

133 {
134 if (pixels.size() == 0) {
135 return;
136 }
137
138 // Get current control values (recalculated each frame)
140
141 // Reorder RGB current values to match the color order (RGB_ORDER template parameter)
142 // The current control values are semantic (current.r controls RED LEDs, etc.)
143 // but need to be sent in wire order matching the pixel data reordering
144 u8 rgb_currents[3] = {current.r, current.g, current.b};
145
146 // Extract channel positions from RGB_ORDER (octal encoding: 0=R, 1=G, 2=B)
147 // Octal digits are read right-to-left in bit positions but left-to-right semantically
148 // RGB (012 octal): wire position 0=R(0), 1=G(1), 2=B(2)
149 // GRB (102 octal): wire position 0=G(1), 1=R(0), 2=B(2)
150 u8 pos0 = (static_cast<int>(RGB_ORDER) >> 6) & 0x3; // Wire position 0 (leftmost octal digit)
151 u8 pos1 = (static_cast<int>(RGB_ORDER) >> 3) & 0x3; // Wire position 1 (middle octal digit)
152 u8 pos2 = (static_cast<int>(RGB_ORDER) >> 0) & 0x3; // Wire position 2 (rightmost octal digit)
153
154 // Reorder: wire R gets current for channel at pos0, etc.
155 u8 r_current = rgb_currents[pos0]; // Wire R (position 0)
156 u8 g_current = rgb_currents[pos1]; // Wire G (position 1)
157 u8 b_current = rgb_currents[pos2]; // Wire B (position 2)
158 u8 w_current = current.w; // W always in position 3
159
160 // Create current control struct with reordered values
162
163 // Get gamma LUT: per-controller override or default 2.8
164 float gamma = this->mSettings.mGamma.value_or(2.8f);
166
167 // UCS7604 is always RGBW — override any user setting.
170
171 // Clear buffer and use encoder to fill it
172 mByteBuffer.clear();
174 MODE, wire_current, pixel_iter.get_rgbw().active(), gamma8.get());
175
176 // Reinterpret byte buffer as CRGB pixels (encoder ensures divisible by 3)
177 size_t num_pixels = mByteBuffer.size() / 3;
179
180 // Construct PixelController and send to delegate controller
182 mDelegate.callShowPixels(pixel_data);
183 }
ChannelOptions mSettings
Optional channel settings (correction, temperature, dither, rgbw, affinity)
virtual int size() const FL_NOEXCEPT
How many LEDs does this controller manage?
static fl::shared_ptr< const Gamma8 > getOrCreate(float gamma) FL_NOEXCEPT
Definition ease.cpp.hpp:459
fl::vector_psram< u8 > mByteBuffer
Definition ucs7604.h:107
DelegateController mDelegate
Definition ucs7604.h:103
UCS7604 controller extending CPixelLEDController.
Definition ucs7604.h:91
CurrentControl brightness()
Get current global UCS7604 brightness value.
To bit_cast(const From &from) FL_NOEXCEPT
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)
Encode complete UCS7604 frame (preamble + padding + pixel data)
Definition ucs7604.h:209
static Rgbw value() FL_NOEXCEPT
Definition rgbw.h:214