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

Method showPixels

src/platforms/wasm/clockless_channel_wasm.h:60–96  ·  view source on GitHub ↗

-- Show pixels This is the main entry point for the controller.

Source from the content-addressed store, hash-verified

58 // -- Show pixels
59 // This is the main entry point for the controller.
60 virtual void showPixels(PixelController<RGB_ORDER>& pixels) override
61 {
62 if (!mDriver) {
63 FL_WARN_EVERY(100, "No Engine");
64 return;
65 }
66 // Wait for previous transmission to complete and release buffer
67 // This prevents race conditions when show() is called faster than hardware can transmit
68 u32 startTime = fl::millis();
69 if (mChannelData->isInUse()) {
70 FL_WARN_EVERY(100, "ClocklessController(wasm): driver should have finished transmitting by now - waiting");
71 bool finished = mDriver->waitForReady();
72 if (!finished) {
73 FL_ERROR("ClocklessController(wasm): Engine still busy after " << fl::millis() - startTime << "ms");
74 return;
75 }
76 }
77
78 // Capture LED data for ActiveStripData BEFORE encoding
79 // This feeds frame data to JavaScript via getFrameData()
80 mCaptureData.clear();
81 PixelController<RGB> pixels_rgb = pixels;
82 // disableColorAdjustment() removes color correction but keeps brightness
83 pixels_rgb.disableColorAdjustment();
84 auto capture_iterator = pixels_rgb.as_iterator(RgbwInvalid());
85 capture_iterator.writeWS2812(&mCaptureData);
86 mTracker.update(mCaptureData);
87
88 // Convert pixels to encoded byte data for channel driver
89 fl::PixelIterator iterator = pixels.as_iterator(this->getRgbw());
90 auto& data = mChannelData->getData();
91 data.clear();
92 iterator.writeWS2812(&data);
93
94 // Enqueue for transmission (will be sent when driver->show() is called)
95 mDriver->enqueue(mChannelData);
96 }
97
98 static fl::shared_ptr<IChannelDriver> getWasmEngine() FL_NOEXCEPT {
99 // Phase 5c of #2428: bypass `ChannelManager` and bind directly to

Callers

nothing calls this directly

Calls 11

RgbwInvalidClass · 0.85
isInUseMethod · 0.80
writeWS2812Method · 0.80
getDataMethod · 0.80
millisFunction · 0.70
waitForReadyMethod · 0.45
clearMethod · 0.45
updateMethod · 0.45
getRgbwMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected