Skip to content

Commit 7237a72

Browse files
update changes based on latest spec pr changes
1 parent 565410a commit 7237a72

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
@@ -466,7 +466,15 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
466466
EndpointId endpoint = commandPath.mEndpointId;
467467
Status status = Status::Success;
468468

469-
if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
469+
// StopMoveStep command has no effect on an active color loop.
470+
// Fetch if it is supported and active.
471+
uint8_t isColorLoopActive = 0;
472+
if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop))
473+
{
474+
Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive);
475+
}
476+
477+
if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride) && !isColorLoopActive)
470478
{
471479
status = stopAllColorTransitions(endpoint);
472480

@@ -1140,7 +1148,7 @@ bool ColorControlServer::computeNewHueValue(ColorControlServer::ColorHueTransiti
11401148
return true;
11411149
}
11421150

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

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

2243-
if (rateX == 0 && rateY == 0)
2244-
{
2245-
commandObj->AddStatus(commandPath, Status::InvalidCommand);
2246-
return true;
2247-
}
2248-
22492251
if (!shouldExecuteIfOff(endpoint, optionsMask, optionsOverride))
22502252
{
22512253
commandObj->AddStatus(commandPath, Status::Success);
@@ -2258,6 +2260,13 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
22582260
// New command. Need to stop any active transitions.
22592261
stopAllColorTransitions(endpoint);
22602262

2263+
if (rateX == 0 && rateY == 0)
2264+
{
2265+
// any current transition has been stopped. We are done.
2266+
commandObj->AddStatus(commandPath, Status::Success);
2267+
return true;
2268+
}
2269+
22612270
// Handle color mode transition, if necessary.
22622271
handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY);
22632272

0 commit comments

Comments
 (0)