-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve rounding to match blueair fan speeds
- Loading branch information
Showing
1 changed file
with
5 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d6c306a
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.
Line 111 seems to point to some kind of round to zero vs round at half, or integer divide vs float divide kind of difference -- in that case, I suspect it also affects other percentages not just 51%. I suspect int((fan_speed * 100) // self._device.speed_count) might fix it without needing the patch at 111 -- as it is the most popular integer version of the formula when floating points were considered expensive, that is most likely used by BlueAir given that they use a single byte to represent the speeds to ensure multiple by 100 does not overflow a single word.
d6c306a
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.
thanks, that sounds good and looks much cleaner, pushed out in 1.11.5