dbusutil: Fix critical bug in scaleSensorReading
If minimum value is not 0,
as is common with temperature sensors of (-128,127) range,
the computed scaled value was wildly incorrect,
because there was a missing step in the math.
Tested: Scaled values now appear correct to me
Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I71290538168e17ac9ebb78489d359f012fbf8517
diff --git a/dbus/dbusutil.cpp b/dbus/dbusutil.cpp
index fc67439..b80dff8 100644
--- a/dbus/dbusutil.cpp
+++ b/dbus/dbusutil.cpp
@@ -52,6 +52,7 @@
{
return;
}
+ value -= min;
value /= (max - min);
}