implement simple min white calculation
This commit is contained in:
parent
151f9e8c43
commit
f36c7ed634
|
@ -0,0 +1 @@
|
||||||
|
.pio
|
21
src/main.cpp
21
src/main.cpp
|
@ -19,7 +19,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SK6812RGBW
|
#define SK6812RGBW //power consumption is around 51mA per LED at RGBW 100%
|
||||||
|
/*
|
||||||
|
R=1234mA (with 112 LEDS 100%)
|
||||||
|
G=1234mA (with 112 LEDS 100%)
|
||||||
|
B=1090mA (with 112 LEDS 100%)
|
||||||
|
W=2100mA (with 112 LEDS 100%)
|
||||||
|
*/
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
@ -259,9 +265,16 @@ void dataMode(){
|
||||||
|
|
||||||
#if defined(SK6812RGBW)
|
#if defined(SK6812RGBW)
|
||||||
//Copy data over
|
//Copy data over
|
||||||
for(int i = 0; i < Num_Leds; i++){
|
for(int i = 0; i < Num_Leds; i++){
|
||||||
//send_leds[i] = CRGBW(0, 0, 0, 50);
|
uint8_t r=leds[i].r;
|
||||||
send_leds[i] = CRGBW(leds[i].r, leds[i].g, leds[i].b, 0);
|
uint8_t g=leds[i].g;
|
||||||
|
uint8_t b=leds[i].b;
|
||||||
|
uint8_t w=min(r,min(g,b)); //get white content and use for white
|
||||||
|
r-=w; //subtract white content
|
||||||
|
g-=w;
|
||||||
|
b-=w;
|
||||||
|
|
||||||
|
send_leds[i] = CRGBW(r, g, b, w); //transfer to rgbw struct
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue