diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index e48fdf07713f49..8d2ab865b247a6 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -176,6 +176,11 @@ void ColorControlServer::handleModeSwitch(EndpointId endpoint, uint8_t newColorM } Attributes::EnhancedColorMode::Set(endpoint, newColorMode); + if (newColorMode == ColorControlServer::ColorMode::COLOR_MODE_EHSV) + { + // Transpose COLOR_MODE_EHSV to COLOR_MODE_HSV after setting EnhancedColorMode + newColorMode = ColorControlServer::ColorMode::COLOR_MODE_HSV; + } Attributes::ColorMode::Set(endpoint, newColorMode); colorModeTransition = static_cast<uint8_t>((newColorMode << 4) + oldColorMode); @@ -788,7 +793,14 @@ bool ColorControlServer::moveHueCommand(EndpointId endpoint, uint8_t moveMode, u } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + if (isEnhanced) + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_EHSV); + } + else + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + } // now, kick off the state machine. initHueSat(endpoint, colorHueTransitionState, colorSaturationTransitionState); @@ -955,7 +967,14 @@ bool ColorControlServer::moveToHueCommand(EndpointId endpoint, uint16_t hue, uin stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + if (isEnhanced) + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_EHSV); + } + else + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + } // now, kick off the state machine. initHueSat(endpoint, colorHueTransitionState, colorSaturationTransitionState); @@ -1067,7 +1086,14 @@ bool ColorControlServer::moveToHueAndSaturationCommand(EndpointId endpoint, uint stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + if (isEnhanced) + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_EHSV); + } + else + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + } // now, kick off the state machine. initHueSat(endpoint, colorHueTransitionState, colorSaturationTransitionState); @@ -1157,7 +1183,14 @@ bool ColorControlServer::stepHueCommand(EndpointId endpoint, uint8_t stepMode, u } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, COLOR_MODE_HSV); + if (isEnhanced) + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_EHSV); + } + else + { + handleModeSwitch(endpoint, ColorControlServer::ColorMode::COLOR_MODE_HSV); + } // now, kick off the state machine. initHueSat(endpoint, colorHueTransitionState, colorSaturationTransitionState); diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index 8723ea77db5e03..536ad22d3e3ce0 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -91,7 +91,8 @@ class ColorControlServer { COLOR_MODE_HSV = 0x00, COLOR_MODE_CIE_XY = 0x01, - COLOR_MODE_TEMPERATURE = 0x02 + COLOR_MODE_TEMPERATURE = 0x02, + COLOR_MODE_EHSV = 0x03 }; enum Conversion