Adding support of subtracting of a white with a given color temperature#1993
Adding support of subtracting of a white with a given color temperature#1993lougovsk wants to merge 19 commits into
Conversation
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
The previous implementation used the raw limiting channel value (uScale) as the white LED drive, which undershot by a factor of sumW/wlim. The correct drive under the 1/3-efficiency model is fRatio*sumW, capped at 255 with fActualRatio back-calculated for the RGB subtraction. Also fix div-by-zero on low color temperatures (zero white channel components), replace non-standard u_int16_t/u_int8_t with uint16_t/ uint8_t, fix invalid default whiteTemp=0 -> 5000, fix _customWhite- Temperature type int -> uint16_t, and improve readability of ColorRgb::white(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 1/3 efficiency assumption (fRatio * sumW) was over-driving the white channel by up to 2x at 2700K, causing warm white flood that washed out saturated colors: magenta lost saturation, green shifted yellow, cyan lost its blue component. Switch to 1:1 (fRatio * 255) which assumes the white LED matches one RGB channel in per-channel output — a better fit for typical RGBW strips. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Revert white drive from fRatio*255 back to fRatio*sumW to test whether the 1/3 efficiency model produces better results now that post-processing gamma correction is properly configured. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This reverts commit 5386c0b.
This reverts commit 2477854.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hello @lougovsk 👋 I'm the Hyperion Project Bot and I want to thank you for To help you and other users test your pull requests faster, 🔗 https://github.com/hyperion-project/hyperion.ng/actions/runs/23771942253 Of course, if you make changes to your PR, I will create a new link. Best regards, |
pow/log -> qPow/qLn in ColorRgb::white(), add <QtMath> include. round -> qRound, std::numeric_limits::infinity() -> qInf() in RgbToRgbw.cpp, remove <limits> include. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hey @lougovsk I created a new link to your workflow artifacts: |
|
Hey @lougovsk I created a new link to your workflow artifacts: |
|
@lougovsk Thank you for your contribution and PR issues. This is well received and appreciated. I did some smaller updates for consistency with the overall project:
Question: Is there a specific reason why the Temperature default is 5000 and not 6600 which is the neutral one?
The finding was as following
Maybe you can check, if it is in line with your intend. |
|
Hey @lougovsk I created a new link to your workflow artifacts: |
|
|
@Lord-Grey now regarding what is the right subtraction algorithm. BTH I don't know. I think a simple plausibility test would be:
Now both algos:
So the algo originally implemented was trying to account for brightness difference of 3 RGB LEDs vs a single white LED. But this also quite a massive assumption, tbh. |
|
How does the output look like in practice with both algorithms? |
|
I will check out in the evening when it gets dark. |
|
@Lord-Grey I've done a short round of A/B testing. TBH I didn't much of a difference. |
Summary
What kind of change does this PR introduce? (check at least one)
If changing the UI of web configuration, please provide the before/after screenshot:
After

Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
Fixes: #xxx[,#xxx], where "xxx" is the issue number)If adding a new feature, the PR's description includes:
PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD
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:
This MR corresponds to the #1956