diff --git a/wled00/colors.cpp b/wled00/colors.cpp index f76499a0..361e3e06 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -62,7 +62,31 @@ void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col); } -void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb +void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc +{ + float r = 0, g = 0, b = 0; + float temp = kelvin / 100; + if (temp <= 66) { + r = 255; + g = round(99.4708025861 * log(temp) - 161.1195681661); + if (temp <= 19) { + b = 0; + } else { + b = round(138.5177312231 * log((temp - 10)) - 305.0447927307); + } + } else { + r = round(329.698727446 * pow((temp - 60), -0.1332047592)); + g = round(288.1221695283 * pow((temp - 60), -0.0755148492)); + b = 255; + } + g += 15; //mod by Aircoookie, a bit less accurate but visibly less pinkish + rgb[0] = (uint8_t) constrain(r, 0, 255); + rgb[1] = (uint8_t) constrain(g, 0, 255); + rgb[2] = (uint8_t) constrain(b, 0, 255); + rgb[3] = 0; +} + +void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb, bins { //this is only an approximation using WS2812B with gamma correction enabled if (mired > 475) { diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 2f414ced..a144e76a 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -31,16 +31,14 @@ Infrared remote: IR info

WLED Broadcast

UDP Port:
+2nd Port:
Receive Brightness, Color, and Effects
Send notifications on direct change:
Send notifications on button press:
Send Alexa notifications:
Send Philips Hue change notifications:
Send Macro notifications:
-Send notifications twice: -

UDP Api

-Enable UDP Api:
-Port:
+Send notifications twice:
Reboot required to apply changes.

Realtime

Receive UDP realtime:

diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm index c0231277..33b80af2 100644 --- a/wled00/data/settings_time.htm +++ b/wled00/data/settings_time.htm @@ -103,7 +103,11 @@ - + + + + +
UTC offset: seconds (max. 18 hours)
Current local time is unknown. diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 12d4854c..fb15e95a 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -30,6 +30,7 @@ void colorFromUint32(uint32_t in, bool secondary = false); void colorFromUint24(uint32_t in, bool secondary = false); void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0); void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb +void colorKtoRGB(uint16_t kelvin, byte* rgb); void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO @@ -102,6 +103,10 @@ void updateInterfaces(uint8_t callMode); void handleTransitions(); void handleNightlight(); +//lx_parser.cpp +bool parseLx(int lxValue, byte* rgbw); +void parseLxJson(int lxValue, byte segId, bool secondary); + //mqtt.cpp bool initMqtt(); void publishMqtt(); @@ -223,7 +228,4 @@ void sappend(char stype, const char* key, int val); void sappends(char stype, const char* key, char* val); void getSettingsJS(byte subPage, char* dest); -//lx_parser.cpp -bool parseLx(int lxValue, int rgbw[4]); - #endif diff --git a/wled00/html_settings.h b/wled00/html_settings.h index b4b96a6f..258a2111 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -167,163 +167,163 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/settings_ui.htm, do not edit!! const char PAGE_settings_ui[] PROGMEM = R"=====(UI Settings