@@ -466,7 +466,15 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
466
466
EndpointId endpoint = commandPath.mEndpointId ;
467
467
Status status = Status::Success;
468
468
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)
470
478
{
471
479
status = stopAllColorTransitions (endpoint);
472
480
@@ -1140,7 +1148,7 @@ bool ColorControlServer::computeNewHueValue(ColorControlServer::ColorHueTransiti
1140
1148
return true ;
1141
1149
}
1142
1150
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
1144
1152
uint8_t isColorLoop = 0 ;
1145
1153
Attributes::ColorLoopActive::Get (p->endpoint , &isColorLoop);
1146
1154
@@ -2240,12 +2248,6 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2240
2248
VerifyOrExit (colorXTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2241
2249
VerifyOrExit (colorYTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2242
2250
2243
- if (rateX == 0 && rateY == 0 )
2244
- {
2245
- commandObj->AddStatus (commandPath, Status::InvalidCommand);
2246
- return true ;
2247
- }
2248
-
2249
2251
if (!shouldExecuteIfOff (endpoint, optionsMask, optionsOverride))
2250
2252
{
2251
2253
commandObj->AddStatus (commandPath, Status::Success);
@@ -2258,6 +2260,13 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2258
2260
// New command. Need to stop any active transitions.
2259
2261
stopAllColorTransitions (endpoint);
2260
2262
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
+
2261
2270
// Handle color mode transition, if necessary.
2262
2271
handleModeSwitch (endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY );
2263
2272
0 commit comments