implement proper white channel calculation

This commit is contained in:
interfisch 2020-12-07 20:51:15 +01:00
parent b5886f0919
commit 30cfb7ffe7
1 changed files with 21 additions and 1 deletions

View File

@ -36,7 +36,7 @@
const uint16_t
Num_Leds = 264; // strip length
const uint8_t
Brightness = 100; // maximum brightness
Brightness = 127; // maximum brightness
// --- FastLED Setings
#if defined(SK6812RGBW)
@ -273,10 +273,30 @@ void dataMode(){
uint8_t r=leds[i].r;
uint8_t g=leds[i].g;
uint8_t b=leds[i].b;
/* Simple 255,255,255 = White approach
uint8_t w=min(r,min(g,b)); //get white content and use for white
r-=w; //subtract white content
g-=w;
b-=w;
*/
// Calibration 20201207. These RGB values match the Neutral White color with calibW brightness.
uint8_t calibR=255;
uint8_t calibG=175;
uint8_t calibB=90;
uint8_t calibW=135;
//one of calibR,calibG or calibB should be 255.
int minval=min(r-calibR,min(g-calibG,b-calibB)); //0 if rgb contains full white. <0 if not full white. -1*(max(calibR,calibG,calibB)) if no white content
float whitecontent=1.0 + (minval/255.0); //scale to: 0=no white, 1=full white content
//subtract white contents from rgb
r-=calibR*whitecontent;
g-=calibG*whitecontent;
b-=calibB*whitecontent;
uint8_t w=calibW*whitecontent;
send_leds[i] = CRGBW(r, g, b, w); //transfer to rgbw struct
}