Skip to content

Commit 2510292

Browse files
authored
ws preview: better handling of RGBW
avoid over-saturation in preview
1 parent c876267 commit 2510292

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

wled00/ws.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,10 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
277277
// WLEDMM begin: preview with color gamma correction
278278
if (gammaCorrectPreview) {
279279
uint8_t w = W(c); // not sure why, but it looks better if using "white" without corrections
280-
buffer[pos++] = qadd8(w, unGamma8(R(c))); //R, add white channel to RGB channels as a simple RGBW -> RGB map
281-
buffer[pos++] = qadd8(w, unGamma8(G(c))); //G
282-
buffer[pos++] = qadd8(w, unGamma8(B(c))); //B
280+
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
281+
buffer[pos++] = unGamma8(R(c)); //R
282+
buffer[pos++] = unGamma8(G(c)); //G
283+
buffer[pos++] = unGamma8(B(c)); //B
283284
} else {
284285
// WLEDMM end
285286
uint8_t w = W(c); // WLEDMM small optimization

0 commit comments

Comments
 (0)