Skip to content

Commit 8bbc88f

Browse files
update changes based on latest spec pr changes
1 parent ed68a4f commit 8bbc88f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/app/clusters/color-control-server/color-control-server.cpp

+17-8
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,15 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
491491
EndpointId endpoint = commandPath.mEndpointId;
492492
Status status = Status::Success;
493493

494-
if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
494+
// StopMoveStep command has no effect on an active color loop.
495+
// Fetch if it is supported and active.
496+
uint8_t isColorLoopActive = 0;
497+
if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop))
498+
{
499+
Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive);
500+
}
501+
502+
if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride) && !isColorLoopActive)
495503
{
496504
status = stopAllColorTransitions(endpoint);
497505

@@ -1165,7 +1173,7 @@ bool ColorControlServer::computeNewHueValue(ColorControlServer::ColorHueTransiti
11651173
return true;
11661174
}
11671175

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

@@ -2265,12 +2273,6 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
22652273
VerifyOrExit(colorXTransitionState != nullptr, status = Status::UnsupportedEndpoint);
22662274
VerifyOrExit(colorYTransitionState != nullptr, status = Status::UnsupportedEndpoint);
22672275

2268-
if (rateX == 0 && rateY == 0)
2269-
{
2270-
commandObj->AddStatus(commandPath, Status::InvalidCommand);
2271-
return true;
2272-
}
2273-
22742276
if (!shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
22752277
{
22762278
commandObj->AddStatus(commandPath, Status::Success);
@@ -2283,6 +2285,13 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
22832285
// New command. Need to stop any active transitions.
22842286
stopAllColorTransitions(endpoint);
22852287

2288+
if (rateX == 0 && rateY == 0)
2289+
{
2290+
// any current transition has been stopped. We are done.
2291+
commandObj->AddStatus(commandPath, Status::Success);
2292+
return true;
2293+
}
2294+
22862295
// Handle color mode transition, if necessary.
22872296
handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY);
22882297

0 commit comments

Comments
 (0)