add hysteresis param to parseThresholdsFromAttr()
Parameter 'hysteresis' with a default = NaN, is added to the header for
parseThresholdsFromAttr(), and existing calls to it now explicitly
specify a hysteresis value.
This is an alternative to having calls to parseThresholdFromAttr() use
a hardcoded Intel-specific value of '0.'
The 'NaN' value was chosen as default because it reflects the value
that was being written before a device-specific value was hardcoded in
to solve a specific issue.
Change was created based on the discussion here:
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/61744/comments/38f6a
221_58a39817a
Tested: Confirmed the code builds and doesn't throw errors with OBMC
'local CI' testing. I believe heavier testing with actual Intel HW
isn't needed because this change simple moves where a value is specified
(from hardcode in function body to passed-in parameter) without
affecting any existing in-use functionality.
Change-Id: I1240b951d6e37adc1aad5ad3b19144f6baa64998
Signed-off-by: Chris Sides <christopher.sides@hpe.com>
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index 6829041..7a64d1e 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -475,7 +475,7 @@
bool parseThresholdsFromAttr(
std::vector<thresholds::Threshold>& thresholdVector,
const std::string& inputPath, const double& scaleFactor,
- const double& offset)
+ const double& offset, const double& hysteresis)
{
const boost::container::flat_map<
std::string, std::vector<std::tuple<const char*, thresholds::Level,
@@ -516,7 +516,8 @@
std::cout << "Threshold: " << attrPath << ": " << *val
<< "\n";
}
- thresholdVector.emplace_back(level, direction, *val, 0);
+ thresholdVector.emplace_back(level, direction, *val,
+ hysteresis);
}
}
}