Skip to content

Commit 52c3aca

Browse files
committed
[Fix] Optimize preset validation by removing redundant command checks in SetActivePreset
1 parent 90fe43f commit 52c3aca

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/app/clusters/thermostat-server/thermostat-server-presets.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,10 @@ Status ThermostatAttrAccess::SetActivePreset(EndpointId endpoint, DataModel::Nul
302302
return Status::InvalidInState;
303303
}
304304

305-
// If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND.
306-
if (!presetHandle.IsNull() && !IsPresetHandlePresentInPresets(delegate, presetHandle.Value()))
307-
{
308-
return Status::InvalidCommand;
309-
}
310-
311305
if (!presetHandle.IsNull())
312306
{
313307
PresetStructWithOwnedMembers matchingPreset;
308+
// Look up the preset once and reuse it to apply any setpoints it carries.
314309
if (!GetMatchingPresetInPresets(delegate, presetHandle, matchingPreset))
315310
{
316311
return Status::InvalidCommand;

0 commit comments

Comments
 (0)