From 2510292d1a8eb099f95aa4307405ed1dad6f892c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:04:18 +0200 Subject: [PATCH] ws preview: better handling of RGBW avoid over-saturation in preview --- wled00/ws.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 32420fcc..5b8bda42 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -277,9 +277,10 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static" // WLEDMM begin: preview with color gamma correction if (gammaCorrectPreview) { uint8_t w = W(c); // not sure why, but it looks better if using "white" without corrections - buffer[pos++] = qadd8(w, unGamma8(R(c))); //R, add white channel to RGB channels as a simple RGBW -> RGB map - buffer[pos++] = qadd8(w, unGamma8(G(c))); //G - buffer[pos++] = qadd8(w, unGamma8(B(c))); //B + if (w>0) c = color_add(c, RGBW32(w, w, w, 0), false); // add white channel to RGB channels - color_add() will prevent over-saturation + buffer[pos++] = unGamma8(R(c)); //R + buffer[pos++] = unGamma8(G(c)); //G + buffer[pos++] = unGamma8(B(c)); //B } else { // WLEDMM end uint8_t w = W(c); // WLEDMM small optimization