2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Incorporated the Scale into the calculation of the value returned

from openbmc-rest, so the values make more sense to humans
This commit is contained in:
Victor Hu 2017-05-24 15:46:23 -04:00
parent 0588d4e060
commit 6e14f1ee08

View File

@ -1220,7 +1220,14 @@ sub rvitals_response {
# $key_url is "/xyz/openbmc_project/sensors/xxx/yyy
# For now display xxx/yyy as a label
my ($junk, $label) = split("/sensors/", $key_url);
$sensor_value = $label . ": " . $content{Value} . " " . $sensor_units{ $content{Unit} };
#
# Calculate the value based on the scale
#
my $calc_value = $content{Value};
if ( $content{Scale} != 0 ) {
$calc_value = ($content{Value} * (10 ** $content{Scale}));
}
$sensor_value = $label . ": " . $calc_value . " " . $sensor_units{ $content{Unit} };
xCAT::SvrUtils::sendmsg("$sensor_value", $callback, $node);
}