Skip to content

Commit

Permalink
fix to avoid looping indefinitely when requesting to move to finalVal…
Browse files Browse the repository at this point in the history
…ue when equal to currentValue
  • Loading branch information
mkardous-silabs committed Sep 17, 2021
1 parent 3178a47 commit dc08bd7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,17 @@ uint16_t ColorControlServer::computeTransitionTimeFromStateAndRate(ColorControlS
min = p->currentValue;
}

transitionTime = max - min;
transitionTime *= 10;
transitionTime /= rate;
// If currentValue == finalValue, force 1 step
if (max == min)
{
transitionTime = 1;
}
else
{
transitionTime = max - min;
transitionTime *= 10;
transitionTime /= rate;
}

if (transitionTime > MAX_INT16U_VALUE)
{
Expand Down

0 comments on commit dc08bd7

Please sign in to comment.