Skip to content

Commit

Permalink
[nrfconnect] Fixed a logic with switching PWMDevice (#18309)
Browse files Browse the repository at this point in the history
PWMDevice component switched on a LED
when an OFF_Action was invoked.
This issue was fixed by adding additional condition.
  • Loading branch information
ArekBalysNordic authored and pull[bot] committed Aug 24, 2023
1 parent 50e4197 commit 376619f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
else if (clusterId == LevelControl::Id && attributeId == LevelControl::Attributes::CurrentLevel::Id)
{
ChipLogProgress(Zcl, "Cluster LevelControl: attribute CurrentLevel set to %u", *value);
GetAppTask().GetLightingDevice().InitiateAction(PWMDevice::LEVEL_ACTION, AppEvent::kEventType_Lighting, value);
if (GetAppTask().GetLightingDevice().IsTurnedOn())
{
GetAppTask().GetLightingDevice().InitiateAction(PWMDevice::LEVEL_ACTION, AppEvent::kEventType_Lighting, value);
}
else
{
ChipLogDetail(Zcl, "LED is off. Try to use move-to-level-with-on-off instead of move-to-level");
}
}
}

Expand Down

0 comments on commit 376619f

Please sign in to comment.