Skip to content

rgbw e131 support #1888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lougovsk
Copy link

@lougovsk lougovsk commented Jun 30, 2025

Summary
This PR primarily focuses on extending current implementation of e1.31 led device to not only support RGB data but also RGBW and hence partially covers #446 feature request for network based led device. Having RGBW implementation for e1.31 will allow in the future to extend wled led device to use not only DDP and RAW but also e1.31 and hence provide native RGBW support. During implementation I've also encountered a problem that some e1.31 (e.g. RGB WLED) doesn't use 512 DMX channels but less (510 = 170 leds*3channels) and hence current e1.31 led device implementation doesn't work correctly with WLED for >170 leds. To address this I've replaced the hardcoded value with a configurable option (see webui changes before/after).I've tested code with my WLED setup using both RGB (white_off) and RGBW (cold/neutral white).

I've started working on this with intension of vibe coding but in the end gave up and put a couple of manual commits. So some of the code has been AI generated, but was reviewed by me.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of web configuration, please provide the before/after screenshot:
before
before
after
after

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing setups:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's body (e.g. Fixes: #xxx[,#xxx], where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated (docs/docs/en)
  • Related tests have been updated

PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD

  • Yes, CHANGELOG.md is also updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

google-labs-jules bot and others added 3 commits June 29, 2025 15:42
This commit introduces RGBW (Red, Green, Blue, White) data handling
for the E1.31 UDP LED device.

Key changes:

1.  **LedDeviceUdpE131.h modifications:**
    *   Included `utils/ColorRgbw.h` and `utils/RgbToRgbw.h`.
    *   Added private member variables:
        *   `_whiteAlgorithm` (RGBW::WhiteAlgorithm) to store the selected white calibration mode.
        *   `_ledRGBWCount` (int) to store the total number of channels (3 for RGB, 4 for RGBW).
        *   `_temp_rgbw` (ColorRgbw) as a temporary variable for color conversion.

2.  **LedDeviceUdpE131.cpp modifications:**
    *   Constructor now initializes `_whiteAlgorithm` to `INVALID` and `_ledRGBWCount` to 0.
    *   `init()` method:
        *   Reads `whiteAlgorithm` from the device configuration (defaults to "white_off").
        *   Converts the string to `RGBW::WhiteAlgorithm`.
        *   Sets `_ledRGBWCount` based on `_ledCount` and whether a white channel is active (3 * _ledCount for RGB, 4 * _ledCount for RGBW).
    *   `write()` method:
        *   Uses `_ledRGBWCount` for `dmxChannelCount`.
        *   Creates a temporary buffer for pixel data.
        *   If `_whiteAlgorithm` is `WHITE_OFF`, copies RGB data directly.
        *   Otherwise, converts RGB to RGBW using `RGBW::Rgb_to_Rgbw` and copies R,G,B,W data.
        *   Populates E1.31 packet properties using the new (potentially RGBW) data buffer.

3.  **JSON Schema Update (libsrc/leddevice/schemas/schema-e131.json):**
    *   Added a `whiteAlgorithm` property to the E1.31 device schema.
    *   This allows users to select the white channel calibration method ("white_off", "subtractive", "additive").
    *   Includes a default value of "white_off".

**Compilation Status:**

The project successfully configures with CMake after installing numerous dependencies (Qt6, libudev, XCB libs, ALSA, CEC, libp8-platform, libusb).
However, the `make` process consistently times out after approximately 6 minutes and 40 seconds, regardless of the number of parallel jobs (`-j nproc`, `-j 2`, `-j 1`) or if a specific target (`hyperiond`) is built.

This suggests a potential hang or an extremely long compilation step for a particular file/module within the project, which could not be identified due to lack of verbose output during the timeout.

Further investigation or environment adjustments are needed to complete the full build.
   ledRGB(W)Count variable from LedDevice instead of creating a new
   locally
2. Fixed the problem where DMX Max channel count was hardcoded to 512.
   WLED e.g. in MultiRGB mode relies on 510 (3*170) channels. On other
   hand for MultiRGBW it expect 512 (4*128) channels. So obviously it
   has to be a parameter.
3. Updated corresponding configuration for WebUI
@lougovsk lougovsk changed the title Feature/rgbw e131 support rgbw e131 support Jun 30, 2025
@lougovsk lougovsk marked this pull request as ready for review June 30, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant