MCPcopy Create free account
hub / github.com/FastLED/FastLED / showPixels

Function showPixels

src/chipsets.h:244–272  ·  view source on GitHub ↗

@brief Main rendering function that converts RGB to RGBW and shows pixels @details This function: 1. Converts each RGB pixel to RGBW format based on the configured conversion mode 2. Packs the RGBW data into a format the RGB controller can transmit 3. Temporarily bypasses color correction/temperature on the base controller 4. Sends the packed data to the physical LED strip @param pixels The pixel

Source from the content-addressed store, hash-verified

242 /// 4. Sends the packed data to the physical LED strip
243 /// @param pixels The pixel controller containing RGB data to be converted
244 virtual void showPixels(PixelController<RGB_ORDER, LANES, MASK> &pixels) override {
245 // Ensure buffer is large enough
246 ensureBuffer(pixels.size());
247 Rgbw rgbw = this->getRgbw();
248 fl::u8 *data = fl::bit_cast_ptr<fl::u8>(mRGBWPixels.get());
249 while (pixels.has(1)) {
250 pixels.stepDithering();
251 pixels.loadAndScaleRGBW(rgbw, data, data + 1, data + 2, data + 3);
252 data += 4;
253 pixels.advanceData();
254 }
255
256 // Force the device controller to a state where it passes data through
257 // unmodified: color correction, color temperature, dither, and brightness
258 // (passed as an argument to show()). Temporarily enable the controller,
259 // show the LEDs, and disable it again.
260 //
261 // The device controller is in the global controller list, so if we
262 // don't keep it disabled, it will refresh again with unknown brightness,
263 // temperature, etc.
264
265 mController.setCorrection(CRGB(255, 255, 255));
266 mController.setTemperature(CRGB(255, 255, 255));
267 mController.setDither(DISABLE_DITHER);
268
269 mController.setEnabled(true);
270 mController.callShow(mRGBWPixels.get(), Rgbw::size_as_rgb(pixels.size()), 255);
271 mController.setEnabled(false);
272 }
273
274 private:
275 /// @brief Initialize the controller and disable the base controller

Callers 2

showColorMethod · 0.70
showMethod · 0.70

Calls 15

ensureBufferFunction · 0.85
RgbwClass · 0.85
encodeWS2816Function · 0.85
setDitherMethod · 0.80
setEnabledMethod · 0.80
callShowMethod · 0.80
CRGBClass · 0.50
sizeMethod · 0.45
getRgbwMethod · 0.45
getMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected