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. (project-chip#29409)
  • Loading branch information
jadhavrohit924 authored Sep 22, 2023
1 parent 2171ee8 commit e0cc25b
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 e0cc25b

Please sign in to comment.