Fixed CT command returned bad value

This commit is contained in:
Stephan Hadinger 2019-04-28 11:33:38 +02:00
parent bc29e499c6
commit efea6bb794
1 changed files with 4 additions and 7 deletions

View File

@ -1874,17 +1874,14 @@ bool LightCommand(void)
uint16_t ct = light_state.getCT(); uint16_t ct = light_state.getCT();
if (option != '\0') { if (option != '\0') {
if ('+' == option) { if ('+' == option) {
ct = (ct > (500-34)) ? 500 : ct + 34; XdrvMailbox.payload = (ct > (500-34)) ? 500 : ct + 34;
} }
else if ('-' == option) { else if ('-' == option) {
ct = (ct < (153+34)) ? 153 : ct - 34; XdrvMailbox.payload = (ct < (153+34)) ? 153 : ct - 34;
} }
} else {
ct = XdrvMailbox.payload;
} }
if ((ct >= 153) && (ct <= 500)) { // https://developers.meethue.com/documentation/core-concepts if ((XdrvMailbox.payload >= 153) && (XdrvMailbox.payload <= 500)) { // https://developers.meethue.com/documentation/core-concepts
//LightSetColorTemp(XdrvMailbox.payload); light_controller.changeCT(XdrvMailbox.payload);
light_controller.changeCT(ct);
coldim = true; coldim = true;
} else { } else {
Response_P(S_JSON_COMMAND_NVALUE, command, ct); Response_P(S_JSON_COMMAND_NVALUE, command, ct);