-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Fan Control]Circular callback fix #36406
[Fan Control]Circular callback fix #36406
Conversation
0a34a55
to
1453f46
Compare
PR #36406: Size comparison from 2af51b0 to 1453f46 Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
7caabc8
to
e0a0c8b
Compare
PR #36406: Size comparison from 9961bb8 to e0a0c8b Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
VerifyOrReturn(Status::Success == status, | ||
ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", to_underlying(status))); | ||
// Adjust PercentSetting from a speed value change for SpeedSetting only when the SpeedSetting change was received | ||
// on a write command, not when it was changed by the server or the app logic. This avoids circular logic such as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no "write command" in Matter. That's Zigbee terminology. Please fix this comment to make sense for Matter.
status = PercentSetting::Set(attributePath.mEndpointId, percentSetting); | ||
VerifyOrReturn(Status::Success == status, | ||
ChipLogError(Zcl, "Failed to set PercentSetting with error: 0x%02x", to_underlying(status))); | ||
// If SpeedSetting is set to 0, the server SHALL set the FanMode attribute value to Off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why are we doing that both in here and in MatterFanControlClusterServerAttributeChangedCallback? That seems pretty odd to me.
ChipLogError(Zcl, "Failed to get PercentSetting with error: 0x%02x", to_underlying(status))); | ||
CHIP_ERROR FanControlAttributeAccessInterface::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) | ||
{ | ||
Status status = Status::Success; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this declared here, not where it's actually used?
#include <app/util/af-types.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
namespace FanControl { | ||
|
||
class FanControlAttributeAccessInterface : public AttributeAccessInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs documentation. The fact that all users of this cluster now need to inherit from this thing, and will get non-spec-compliant behavior unless they do (which is an API break, by the way), is extremely non-obvious.
What should have happened here is that if we need an AttributeAccessInterface registered for proper cluster functionality then the cluster needs to register it. And if we have things the app needs to handle, the cluster should be calling out into the app for those things, via the relevant delegate interface, instead of the app implementing AttributeAccessInterface directly.
@@ -24,6 +24,7 @@ | |||
#include <app-common/zap-generated/cluster-objects.h> | |||
#include <app-common/zap-generated/ids/Attributes.h> | |||
#include <app-common/zap-generated/ids/Clusters.h> | |||
#include <app/AttributeAccessInterfaceRegistry.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere in this file?
…#36406)" (project-chip#36475) This reverts commit 078bc30.
Proposed fix to circumvent the circular callback when a percentage change happens with a max speed value below 100.
Basically, currently, with a max speed of 10, what happens is:
Attribute write PercentSetting 25
PercentSetting Change to 25 Callback
SpeedSetting Change 3 Callback
PercentSetting Change 30 Callback.
Added AttributeAccessInterface and used it in All-cluster app.