Skip to content

Commit

Permalink
fix to avoid looping indefinitely when moving to finalValue when equa…
Browse files Browse the repository at this point in the history
…l to current value (#9776)

* fix to avoid looping indefinitely when requesting to move to finalValue when equal to currentValue

* Moved fix to cover more cases
Checks if transitionTime is equal 0 after calculations

* restyle

* changed check to remove max function
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Sep 20, 2021
1 parent 8d0309d commit 4895073
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ uint16_t ColorControlServer::computeTransitionTimeFromStateAndRate(ColorControlS
transitionTime *= 10;
transitionTime /= rate;

// If transitionTime == 0, force 1 step
transitionTime = transitionTime == 0 ? 1 : transitionTime;

if (transitionTime > MAX_INT16U_VALUE)
{
return MAX_INT16U_VALUE;
Expand Down

0 comments on commit 4895073

Please sign in to comment.