Skip to content

Commit

Permalink
Fix constraint error check for the STEP feature of Temperature Contro…
Browse files Browse the repository at this point in the history
…l cluster. (#29409)
  • Loading branch information
jadhavrohit924 authored and pull[bot] committed Dec 4, 2023
1 parent 23f041e commit 1257352
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler
goto exit;
}

if (targetTemperature.Value() < minTemperature || targetTemperature.Value() > maxTemperature)
{
status = Status::ConstraintError;
goto exit;
}
if (TemperatureControlHasFeature(endpoint, TemperatureControl::Feature::kTemperatureStep))
{
int16_t step = 0;
Expand All @@ -161,14 +166,6 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler
goto exit;
}
}
else
{
if (targetTemperature.Value() < minTemperature || targetTemperature.Value() > maxTemperature)
{
status = Status::ConstraintError;
goto exit;
}
}
emberAfStatus = TemperatureSetpoint::Set(endpoint, targetTemperature.Value());
if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS)
{
Expand Down

0 comments on commit 1257352

Please sign in to comment.