From 125735245b6d2e95dbc4efbc3ad0ef3183252be5 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:31:58 +0530 Subject: [PATCH] Fix constraint error check for the STEP feature of Temperature Control cluster. (#29409) --- .../temperature-control-server.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/clusters/temperature-control-server/temperature-control-server.cpp b/src/app/clusters/temperature-control-server/temperature-control-server.cpp index cdfd9099e71711..8c72347818333e 100644 --- a/src/app/clusters/temperature-control-server/temperature-control-server.cpp +++ b/src/app/clusters/temperature-control-server/temperature-control-server.cpp @@ -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; @@ -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) {