preview at full brightness

* reverts global brightness in preview
* can NOT revert brightness reductions from auto brightness limiter.
This commit is contained in:
Frank
2023-07-10 18:29:16 +02:00
parent 9ed5dc7c02
commit c22c92e3af
2 changed files with 18 additions and 5 deletions

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2307080
#define VERSION 2307100
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG

View File

@@ -167,6 +167,17 @@ void sendDataWs(AsyncWebSocketClient * client)
releaseJSONBufferLock();
}
// WLEDMM function to recover full-brigh pixel (based on code from upstream alt-buffer, which is based on code from NeoPixelBrightnessBus)
static uint32_t restoreColorLossy(uint32_t c, uint_fast8_t _restaurationBri) {
if (_restaurationBri == 255) return c;
uint8_t* chan = (uint8_t*) &c;
for (uint_fast8_t i=0; i<4; i++) {
uint_fast16_t val = chan[i];
chan[i] = ((val << 8) + _restaurationBri) / (_restaurationBri + 1); //adding _bri slighly improves recovery / stops degradation on re-scale
}
return c;
}
static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
{
AsyncWebSocketClient * wsc = ws.client(wsClient);
@@ -219,13 +230,15 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
}
#endif
uint8_t stripBrightness = strip.getBrightness();
for (size_t i = 0; pos < bufSize -2; i += n)
{
//WLEDMM: no skipLines
uint32_t c = strip.getPixelColor(i);
buffer[pos++] = qadd8(W(c), R(c)); //R, add white channel to RGB channels as a simple RGBW -> RGB map
buffer[pos++] = qadd8(W(c), G(c)); //G
buffer[pos++] = qadd8(W(c), B(c)); //B
uint32_t c = restoreColorLossy(strip.getPixelColor(i), stripBrightness); // WLEDMM full bright preview - does _not_ recover ABL reductions
uint8_t w = W(c); // WLEDMM small optimization
buffer[pos++] = qadd8(w, R(c)); //R, add white channel to RGB channels as a simple RGBW -> RGB map
buffer[pos++] = qadd8(w, G(c)); //G
buffer[pos++] = qadd8(w, B(c)); //B
}
wsc->binary(wsBuf);