From efea6bb79474309f63752f9a4a5fe04d03ef0cb7 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 28 Apr 2019 11:33:38 +0200 Subject: [PATCH] Fixed CT command returned bad value --- sonoff/xdrv_04_light.ino | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index f6338ded2..d54da085c 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1874,17 +1874,14 @@ bool LightCommand(void) uint16_t ct = light_state.getCT(); if (option != '\0') { if ('+' == option) { - ct = (ct > (500-34)) ? 500 : ct + 34; + XdrvMailbox.payload = (ct > (500-34)) ? 500 : ct + 34; } 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 - //LightSetColorTemp(XdrvMailbox.payload); - light_controller.changeCT(ct); + if ((XdrvMailbox.payload >= 153) && (XdrvMailbox.payload <= 500)) { // https://developers.meethue.com/documentation/core-concepts + light_controller.changeCT(XdrvMailbox.payload); coldim = true; } else { Response_P(S_JSON_COMMAND_NVALUE, command, ct);