From 71be5a1c7c8617fdaed4411eb00c7ee344a055c7 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Mon, 23 Nov 2020 23:32:08 +0300 Subject: [PATCH] Color temperature --- lighthub/item.cpp | 10 +++- lighthub/itemCmd.cpp | 108 +++++++++++++++++++++++++++++++------------ lighthub/itemCmd.h | 4 +- 3 files changed, 89 insertions(+), 33 deletions(-) diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 2bb5935..482b941 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -510,6 +510,9 @@ st.setSuffix(suffixCode); case S_SAT: st.setS(Par[0]); break; + case S_TEMP: + st.setColorTemp(Par[0]); + break; default: switch (i) //Number of params { @@ -584,7 +587,7 @@ int Item::Ctrl(itemCmd cmd, char* subItem) suffixCode = defaultSuffixCode; - debugSerial<=0) + { + setColorTemp(t); + } + cmd.suffixCode=from.cmd.suffixCode; + + switch (cmd.itemArgType){ //Destination case ST_HSV: case ST_PERCENTS: @@ -293,6 +312,7 @@ itemCmd itemCmd::assignFrom(itemCmd from) case ST_HS: param.h=from.param.h; param.s=from.param.s; + break; case ST_PERCENTS: param.v=from.param.v; @@ -325,9 +345,9 @@ itemCmd itemCmd::assignFrom(itemCmd from) param.b=from.param.b; cmd.itemArgType=from.cmd.itemArgType; break; - case ST_HS: - param.v=map(from.param.v,0,100,0,255); case ST_HSV: + param.v=map(from.param.v,0,100,0,255); + case ST_HS: param.h=from.param.h; param.s=from.param.s; //param.s=map(from.param.s,0,100,0,255); @@ -415,7 +435,7 @@ itemCmd itemCmd::assignFrom(itemCmd from) } } //Converting current obj to HSV - + debugSerial<255) rgbValue = 255; - } - else - { - rgbSaturation = map(rgbSaturation, 128, 255, 100, 255); - param.w=0; - } - debugSerial<255) rgbValue = 255; + } + else + { + rgbSaturation = map(rgbSaturation, 128, 255, 100, 255); + param.w=0; + }; + debugSerial<255) rgbValue = 255; + } + else + { + rgbSaturation = map(rgbSaturation, 128, 255, 100, 255); + param.w=0; + }; + debugSerial<