Skip to content

Commit

Permalink
Fix MoveToLevelWithOnOff to only set the SceneGlobalControl to true i…
Browse files Browse the repository at this point in the history
…f it produced a On value. Also we were not checking the featuremap of the right cluster (project-chip#24800)
  • Loading branch information
jmartinez-silabs authored Feb 2, 2023
1 parent 79d5ac4 commit 836390e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,14 @@ static EmberAfStatus moveToLevelHandler(EndpointId endpoint, CommandId commandId
schedule(endpoint, computeCallbackWaitTimeMs(state->callbackSchedule, state->eventDurationMs));
status = EMBER_ZCL_STATUS_SUCCESS;

if (commandId == Commands::MoveToLevelWithOnOff::Id)
#ifdef EMBER_AF_PLUGIN_ON_OFF
// Check that the received MoveToLevelWithOnOff produces a On action and that the onoff support the lighting featuremap
if (commandId == Commands::MoveToLevelWithOnOff::Id && state->moveToLevel != state->minLevel &&
OnOffServer::Instance().SupportsLightingApplications(endpoint))
{
uint32_t featureMap;
if (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS &&
READBITS(featureMap, EMBER_AF_LEVEL_CONTROL_FEATURE_LIGHTING))
{
OnOff::Attributes::GlobalSceneControl::Set(endpoint, true);
}
OnOff::Attributes::GlobalSceneControl::Set(endpoint, true);
}
#endif // EMBER_AF_PLUGIN_ON_OFF

return status;
}
Expand Down

0 comments on commit 836390e

Please sign in to comment.