pwm: fix bad scaling due to use of integer type

This fixes commit c1a1f4ff20 ("pwm: Move
scaling factor from sensors prog to library") which didn't account for
return type of `get_type_scaling()` being `int` rather than `double` or
`float`, so the scaling was done by a factor of 2 instead of 2.55, thus
making the result off by quite a lot.

ms: adjust test
This commit is contained in:
xaizek authored and Michal Suchanek committed 2026-04-21 13:24:21 +02:00
1 parent c297368a0e
commit 62a9553191
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -139,7 +139,7 @@ static int sysfs_foreach_busdev(const char *bus_type,
const char *sensors_sysfs_mount = "/sys";
static
int get_type_scaling(sensors_subfeature_type type)
double get_type_scaling(sensors_subfeature_type type)
{
/* Multipliers for second class subfeatures
that need their own multiplier */
+2 -2
View File
@@ -388,7 +388,7 @@
"crit": {
"quantity": "temperature",
"unit": "°C",
"value": 93.85
"value": 93.84999999999999
},
"input": {
"quantity": "temperature",
@@ -399,7 +399,7 @@
"max": {
"quantity": "temperature",
"unit": "°C",
"value": 89.85
"value": 89.84999999999999
},
"min": {
"quantity": "temperature",