Skip to content

Backport the fan-control circular callback changes to v1.3-branch.#40305

Merged
andy31415 merged 2 commits intoproject-chip:v1.3-branchfrom
shripad621git:cherry_pick/fan_control
Jul 29, 2025
Merged

Backport the fan-control circular callback changes to v1.3-branch.#40305
andy31415 merged 2 commits intoproject-chip:v1.3-branchfrom
shripad621git:cherry_pick/fan_control

Conversation

@shripad621git
Copy link
Copy Markdown
Contributor

@shripad621git shripad621git commented Jul 25, 2025

Summary

Testing

soares-sergio and others added 2 commits July 25, 2025 18:07
* fan_control_server: Fix circular callback issue

This PR fixes a circular callback bug in fan control server using flags
when updating SpeedSetting and PercentSetting.

Before this change, a PercentSetting write to 25% would end up circling
back to 30% as shown:

```
[MatterTest] 11-12 19:16:40.792 INFO @@@ WRITE PercentSetting to 25
[MatterTest] 11-12 19:16:40.801 INFO @@@ ATTRIB: EP1/FanControl/SpeedSetting: 3
[MatterTest] 11-12 19:16:40.802 INFO @@@ ATTRIB: EP1/FanControl/SpeedCurrent: 3
[MatterTest] 11-12 19:16:40.802 INFO @@@ ATTRIB: EP1/FanControl/PercentSetting: 30
[MatterTest] 11-12 19:16:40.802 INFO @@@ ATTRIB: EP1/FanControl/PercentCurrent: 30
```

Now it behaves as expected:
```
[MatterTest] 11-13 18:54:27.961 INFO @@@ WRITE PercentSetting to 25
[MatterTest] 11-13 18:54:27.970 INFO @@@ ATTRIB: EP1/FanControl/SpeedSetting: 3
[MatterTest] 11-13 18:54:27.970 INFO @@@ ATTRIB: EP1/FanControl/SpeedCurrent: 3
[MatterTest] 11-13 18:54:27.970 INFO @@@ ATTRIB: EP1/FanControl/PercentSetting: 25
[MatterTest] 11-13 18:54:27.971 INFO @@@ ATTRIB: EP1/FanControl/PercentCurrent: 25
```

Co-authored-by: lpbeliveau-silabs <louis-philip.beliveau@silabs.com>

* Addressed review suggestions

---------

Co-authored-by: lpbeliveau-silabs <louis-philip.beliveau@silabs.com>
…#36515)

Similar to what was done for Speed and Percent, this PR fixes a bug where
a FanMode could result in a circular callback.

For example, setting the FanMode to kAuto, could trigger this issue.
@github-actions github-actions bot added the app label Jul 25, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request backports changes to fix circular callback issues in the fan-control server by using ScopedChange to prevent re-entrant attribute writes. The implementation is sound. My review includes a suggestion to replace a floating-point calculation with integer arithmetic for consistency and efficiency.

@shripad621git shripad621git marked this pull request as ready for review July 25, 2025 18:02
@andy31415 andy31415 merged commit bf6da6f into project-chip:v1.3-branch Jul 29, 2025
60 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants