Fixes for when sensor value is a double
The change to the xyz.openbmc_project.Sensor.Value interface that moves
the Value property to a double from an int64_t has merged, which
uncovered some problems in the code that was trying to detect the type
and handle it accordingly.
This does remove support for the Scale property on the Value interface,
as meson CI won't even compile with it since the double version of it is
empty and so the function has unused parameters, which meson doesn't
like.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I34dc6cc83dae76a879258bf3c6859cd348e4de4d
diff --git a/mainloop.cpp b/mainloop.cpp
index 7303307..b694261 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -76,7 +76,7 @@
Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi =
&CriticalObject::criticalAlarmHigh;
-void updateSensorInterfaces(InterfaceMap& ifaces, int64_t value)
+void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value)
{
for (auto& iface : ifaces)
{
@@ -244,12 +244,8 @@
exit(EXIT_FAILURE);
}
auto sensorValue = valueInterface->value();
- int64_t scale = 0;
- // scale the thresholds only if we're using doubles
- if constexpr (std::is_same<SensorValueType, double>::value)
- {
- scale = sensorObj->getScale();
- }
+ int64_t scale = sensorObj->getScale();
+
addThreshold<WarningObject>(sensorSysfsType, std::get<sensorID>(properties),
sensorValue, info, scale);
addThreshold<CriticalObject>(sensorSysfsType,
@@ -418,7 +414,7 @@
input = hwmon::entry::average;
}
- int64_t value;
+ SensorValueType value;
auto& obj = std::get<InterfaceMap>(objInfo);
std::unique_ptr<sensor::Sensor>& sensor = _sensorObjects[sensorSetKey];