Skip to content

Commit

Permalink
[nrf fromtree] When dimming a light/bulb over time or changing color …
Browse files Browse the repository at this point in the history
…the thread network can be spammed (#31778)

* Adding diff

* Restyled by clang-format

---------

Cherry picked commit: 935aa450

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and kkasperczyk-no committed Feb 16, 2024
1 parent c1d6f8a commit 3da4402
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,24 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint)

isColorTempTransitionDone = computeNewColor16uValue(colorTempTransitionState);

if (!isColorTempTransitionDone)
{
// Check whether our color temperature has actually changed. If not, do
// nothing, and wait for it to change.
uint16_t currentColorTemp;
if (Attributes::ColorTemperatureMireds::Get(endpoint, &currentColorTemp) != EMBER_ZCL_STATUS_SUCCESS)
{
// Why can't we read our attribute?
return;
}

if (currentColorTemp == colorTempTransitionState->currentValue)
{
scheduleTimerCallbackMs(configureTempEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count());
return;
}
}

Attributes::RemainingTime::Set(endpoint, colorTempTransitionState->timeRemaining);

if (isColorTempTransitionDone)
Expand Down

0 comments on commit 3da4402

Please sign in to comment.