pwmsensor: Correct the type of MaxValue/MinValue
The MaxValue/MinValue must be double so that redfish can read the value
Before:
{
"@odata.id": "/redfish/v1/Chassis/<chassis>/Thermal#/Fans/0",
"@odata.type": "#Thermal.v1_3_0.Fan",
"MemberId": "fan0_pwm",
"Name": "fan0 pwm",
"Reading": 25,
"ReadingUnits": "Percent",
"Status": {
"Health": "OK",
"State": "Enabled"
}
},
After:
{
"@odata.id": "/redfish/v1/Chassis/<chassis>/Thermal#/Fans/0",
"@odata.type": "#Thermal.v1_3_0.Fan",
"MaxReadingRange": 100,
"MemberId": "fan0_pwm",
"MinReadingRange": 0,
"Name": "fan0 pwm",
"Reading": 90,
"ReadingUnits": "Percent",
"Status": {
"Health": "OK",
"State": "Enabled"
}
},
ref:
https://github.com/openbmc/phosphor-dbus-interfaces/blob/a134741830/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml#L27-L36
Signed-off-by: David Wang <davidwang@quantatw.com>
Change-Id: I2e1c94648d344988f23aef68fe7a70ad0d7ba3b8
diff --git a/src/PwmSensor.cpp b/src/PwmSensor.cpp
index ae7b240..0ee8c88 100644
--- a/src/PwmSensor.cpp
+++ b/src/PwmSensor.cpp
@@ -104,8 +104,8 @@
return curVal;
});
// pwm sensor interface is in percent
- sensorInterface->register_property("MaxValue", static_cast<int64_t>(100));
- sensorInterface->register_property("MinValue", static_cast<int64_t>(0));
+ sensorInterface->register_property("MaxValue", static_cast<double>(100));
+ sensorInterface->register_property("MinValue", static_cast<double>(0));
sensorInterface->register_property("Unit", sensor_paths::unitPercent);
controlInterface = objectServer.add_interface(