Skip to content

Commit

Permalink
update changes based on latest spec pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs committed Jun 17, 2024
1 parent 565410a commit 7237a72
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,15 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;

if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
// StopMoveStep command has no effect on an active color loop.
// Fetch if it is supported and active.
uint8_t isColorLoopActive = 0;
if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop))
{
Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive);
}

if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride) && !isColorLoopActive)
{
status = stopAllColorTransitions(endpoint);

Expand Down Expand Up @@ -1140,7 +1148,7 @@ bool ColorControlServer::computeNewHueValue(ColorControlServer::ColorHueTransiti
return true;
}

// Check if we are in a color loop. If not, we are in a moveHue
// Check if we are in a color loop. If not, we are in a moveHue
uint8_t isColorLoop = 0;
Attributes::ColorLoopActive::Get(p->endpoint, &isColorLoop);

Expand Down Expand Up @@ -2240,12 +2248,6 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
VerifyOrExit(colorXTransitionState != nullptr, status = Status::UnsupportedEndpoint);
VerifyOrExit(colorYTransitionState != nullptr, status = Status::UnsupportedEndpoint);

if (rateX == 0 && rateY == 0)
{
commandObj->AddStatus(commandPath, Status::InvalidCommand);
return true;
}

if (!shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
{
commandObj->AddStatus(commandPath, Status::Success);
Expand All @@ -2258,6 +2260,13 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
// New command. Need to stop any active transitions.
stopAllColorTransitions(endpoint);

if (rateX == 0 && rateY == 0)
{
// any current transition has been stopped. We are done.
commandObj->AddStatus(commandPath, Status::Success);
return true;
}

// Handle color mode transition, if necessary.
handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY);

Expand Down

0 comments on commit 7237a72

Please sign in to comment.