Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrfconnect] Fixed window covering bug in updating cluster attributes #18752

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ endpoint 1 {
persist attribute installedClosedLimitLift default = 0xFFFF;
persist attribute installedOpenLimitTilt;
persist attribute installedClosedLimitTilt default = 0xFFFF;
persist attribute mode default = 0x14;
persist attribute mode;
ram attribute safetyStatus;
ram attribute featureMap default = 0x0017;
ram attribute clusterRevision default = 5;
Expand Down
7 changes: 4 additions & 3 deletions examples/window-app/common/window-app.zap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"featureLevel": 70,
"featureLevel": 71,
"creator": "zap",
"keyValuePairs": [
{
Expand Down Expand Up @@ -8780,7 +8780,7 @@
"storageOption": "NVM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x14",
"defaultValue": "0x0",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -10438,5 +10438,6 @@
"endpointVersion": 1,
"deviceIdentifier": 514
}
]
],
"log": []
}
19 changes: 19 additions & 0 deletions examples/window-app/nrfconnect/main/WindowCovering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,22 @@ uint8_t WindowCovering::PositionToBrightness(uint16_t aPosition, MoveType aMoveT

return Percent100thsToValue(pwmLimits, aPosition);
}

void WindowCovering::SchedulePostAttributeChange(chip::EndpointId aEndpoint, chip::AttributeId aAttributeId)
{
AttributeUpdateData * data = chip::Platform::New<AttributeUpdateData>();
VerifyOrReturn(data != nullptr);

data->mEndpoint = aEndpoint;
data->mAttributeId = aAttributeId;

chip::DeviceLayer::PlatformMgr().ScheduleWork(DoPostAttributeChange, reinterpret_cast<intptr_t>(data));
}

void WindowCovering::DoPostAttributeChange(intptr_t aArg)
{
AttributeUpdateData * data = reinterpret_cast<AttributeUpdateData *>(aArg);
VerifyOrReturn(data != nullptr);

PostAttributeChange(data->mEndpoint, data->mAttributeId);
}
1 change: 1 addition & 0 deletions examples/window-app/nrfconnect/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ void MatterWindowCoveringClusterServerAttributeChangedCallback(const app::Concre
break;
};
}
WindowCovering::Instance().SchedulePostAttributeChange(attributePath.mEndpointId, attributePath.mAttributeId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class WindowCovering
NONE
};

struct AttributeUpdateData
{
chip::EndpointId mEndpoint;
chip::AttributeId mAttributeId;
};

WindowCovering();
static WindowCovering & Instance()
{
Expand All @@ -49,6 +55,7 @@ class WindowCovering
MoveType GetMoveType() { return mCurrentUIMoveType; }
void PositionLEDUpdate(MoveType aMoveType);

static void SchedulePostAttributeChange(chip::EndpointId aEndpoint, chip::AttributeId aAttributeId);
static constexpr chip::EndpointId Endpoint() { return 1; };

private:
Expand All @@ -63,6 +70,7 @@ class WindowCovering
static void DriveCurrentLiftPosition(intptr_t);
static void DriveCurrentTiltPosition(intptr_t);
static void MoveTimerTimeoutCallback(k_timer * aTimer);
static void DoPostAttributeChange(intptr_t aArg);

MoveType mCurrentUIMoveType;
LEDWidget mLiftLED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,6 @@ EmberEventControl * ConfigureFakeMotionEventControl(EndpointId endpoint)
return controller;
}

/**
* @brief PostAttributeChange is called when an Attribute is modified
*
* @param[in] endpoint
* @param[in] attributeId
*/
void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeId)
{
// all-cluster-app: simulation for the CI testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ void TiltPositionSet(chip::EndpointId endpoint, NPercent100ths position);

EmberAfStatus GetMotionLockStatus(chip::EndpointId endpoint);

/**
* @brief PostAttributeChange is called when an Attribute is modified
*
* @param[in] endpoint
* @param[in] attributeId
*/
void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeId);
Damian-Nordic marked this conversation as resolved.
Show resolved Hide resolved

} // namespace WindowCovering
} // namespace Clusters
} // namespace app
Expand Down
2 changes: 1 addition & 1 deletion zzz_generated/window-app/zap-generated/endpoint_config.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.