-
-
Notifications
You must be signed in to change notification settings - Fork 317
Open
Description
The DisplayProgressBar method in lcd_comm.py calculates the filled width using the raw value rather than the value's offset from min_value:
# Current (line 359)
bar_filled_width = (value / (max_value - min_value) * width) - 1
# Should be
bar_filled_width = ((value - min_value) / (max_value - min_value) * width) - 1When min_value is 0 (the default), this has no effect — which is why it's gone unnoticed. But for any bar with a non-zero minimum (e.g. a temperature bar with min=25, max=95), the fill is wrong:
| value | min | max | buggy fill | correct fill |
|---|---|---|---|---|
| 25 | 25 | 95 | 36% | 0% |
| 60 | 25 | 95 | 86% | 50% |
| 95 | 25 | 95 | 136% (clamped) | 100% |
DisplayRadialProgressBar already does this correctly on line 560:
pct = (value - min_value) / (max_value - min_value)Happy to submit a one-line PR if you'd like.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels