FanSensor: Add configurable min max
Allow Min and Max reading to be configured
Tested-by: Set a fan to a different Min and it worked.
Change-Id: Ibeebcaa9672d7a9cd9511c3845f5b317db8962c8
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index 63ced19..70d7d4c 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -31,9 +31,6 @@
static constexpr unsigned int pwmPollMs = 500;
static constexpr size_t warnAfterErrorCount = 10;
-static constexpr double maxReading = 25000;
-static constexpr double minReading = 0;
-
TachSensor::TachSensor(const std::string &path, const std::string &objectType,
sdbusplus::asio::object_server &objectServer,
std::shared_ptr<sdbusplus::asio::connection> &conn,
@@ -41,10 +38,11 @@
const std::shared_ptr<RedundancySensor> &redundancy,
boost::asio::io_service &io, const std::string &fanName,
std::vector<thresholds::Threshold> &&_thresholds,
- const std::string &sensorConfiguration) :
+ const std::string &sensorConfiguration,
+ const std::pair<size_t, size_t> &limits) :
Sensor(boost::replace_all_copy(fanName, " ", "_"), path,
- std::move(_thresholds), sensorConfiguration, objectType, maxReading,
- minReading),
+ std::move(_thresholds), sensorConfiguration, objectType,
+ limits.second, limits.first),
objServer(objectServer), dbusConnection(conn),
presence(std::move(presence)), redundancy(redundancy),
inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), errCount(0)