Correct scaling for peek.
This commit is contained in:
parent
f437fd6cd6
commit
2ad3ab7f0d
@ -1089,13 +1089,13 @@ bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient)
|
|||||||
for (size_t i= 0; i < used; i += n)
|
for (size_t i= 0; i < used; i += n)
|
||||||
{
|
{
|
||||||
uint32_t c = strip.getPixelColor(i);
|
uint32_t c = strip.getPixelColor(i);
|
||||||
uint8_t r = useGlobalLedBuffer ? scale8(R(c), strip.getBrightness()) : R(c);
|
uint8_t r = R(c);
|
||||||
uint8_t g = useGlobalLedBuffer ? scale8(G(c), strip.getBrightness()) : G(c);
|
uint8_t g = G(c);
|
||||||
uint8_t b = useGlobalLedBuffer ? scale8(B(c), strip.getBrightness()) : B(c);
|
uint8_t b = B(c);
|
||||||
uint8_t w = useGlobalLedBuffer ? scale8(W(c), strip.getBrightness()) : W(c);
|
uint8_t w = W(c);
|
||||||
r = qadd8(w, r); //R, add white channel to RGB channels as a simple RGBW -> RGB map
|
r = scale8(qadd8(w, r), strip.getBrightness()); //R, add white channel to RGB channels as a simple RGBW -> RGB map
|
||||||
g = qadd8(w, g); //G
|
g = scale8(qadd8(w, g), strip.getBrightness()); //G
|
||||||
b = qadd8(w, b); //B
|
b = scale8(qadd8(w, b), strip.getBrightness()); //B
|
||||||
olen += sprintf(obuf + olen, "\"%06X\",", RGBW32(r,g,b,0));
|
olen += sprintf(obuf + olen, "\"%06X\",", RGBW32(r,g,b,0));
|
||||||
}
|
}
|
||||||
olen -= 1;
|
olen -= 1;
|
||||||
|
@ -166,14 +166,15 @@ bool sendLiveLedsWs(uint32_t wsClient)
|
|||||||
size_t n = ((used -1)/MAX_LIVE_LEDS_WS) +1; //only serve every n'th LED if count over MAX_LIVE_LEDS_WS
|
size_t n = ((used -1)/MAX_LIVE_LEDS_WS) +1; //only serve every n'th LED if count over MAX_LIVE_LEDS_WS
|
||||||
size_t pos = (strip.isMatrix ? 4 : 2); // start of data
|
size_t pos = (strip.isMatrix ? 4 : 2); // start of data
|
||||||
size_t bufSize = pos + (used/n)*3;
|
size_t bufSize = pos + (used/n)*3;
|
||||||
size_t skipLines = 0;
|
|
||||||
|
|
||||||
AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(bufSize);
|
AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(bufSize);
|
||||||
if (!wsBuf) return false; //out of memory
|
if (!wsBuf) return false; //out of memory
|
||||||
uint8_t* buffer = wsBuf->get();
|
uint8_t* buffer = wsBuf->get();
|
||||||
buffer[0] = 'L';
|
buffer[0] = 'L';
|
||||||
buffer[1] = 1; //version
|
buffer[1] = 1; //version
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
|
size_t skipLines = 0;
|
||||||
if (strip.isMatrix) {
|
if (strip.isMatrix) {
|
||||||
buffer[1] = 2; //version
|
buffer[1] = 2; //version
|
||||||
buffer[2] = Segment::maxWidth;
|
buffer[2] = Segment::maxWidth;
|
||||||
@ -198,13 +199,13 @@ bool sendLiveLedsWs(uint32_t wsClient)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
uint32_t c = strip.getPixelColor(i);
|
uint32_t c = strip.getPixelColor(i);
|
||||||
uint8_t r = useGlobalLedBuffer ? scale8(R(c), strip.getBrightness()) : R(c);
|
uint8_t r = R(c);
|
||||||
uint8_t g = useGlobalLedBuffer ? scale8(G(c), strip.getBrightness()) : G(c);
|
uint8_t g = G(c);
|
||||||
uint8_t b = useGlobalLedBuffer ? scale8(B(c), strip.getBrightness()) : B(c);
|
uint8_t b = B(c);
|
||||||
uint8_t w = useGlobalLedBuffer ? scale8(W(c), strip.getBrightness()) : W(c);
|
uint8_t w = W(c);
|
||||||
buffer[pos++] = qadd8(w, r); //R, add white channel to RGB channels as a simple RGBW -> RGB map
|
buffer[pos++] = scale8(qadd8(w, r), strip.getBrightness()); //R, add white channel to RGB channels as a simple RGBW -> RGB map
|
||||||
buffer[pos++] = qadd8(w, g); //G
|
buffer[pos++] = scale8(qadd8(w, g), strip.getBrightness()); //G
|
||||||
buffer[pos++] = qadd8(w, b); //B
|
buffer[pos++] = scale8(qadd8(w, b), strip.getBrightness()); //B
|
||||||
}
|
}
|
||||||
|
|
||||||
wsc->binary(wsBuf);
|
wsc->binary(wsBuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user