-- Show pixels This is the main entry point for the controller.
| 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 |
nothing calls this directly
no test coverage detected