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/FanMain.cpp b/src/FanMain.cpp
index 365fd90..121621d 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -124,9 +124,7 @@
const char* baseType;
const SensorData* sensorData = nullptr;
const std::string* interfacePath = nullptr;
- const std::pair<std::string, boost::container::flat_map<
- std::string, BasicVariantType>>*
- baseConfiguration = nullptr;
+ const SensorBaseConfiguration* baseConfiguration = nullptr;
for (const std::pair<sdbusplus::message::object_path, SensorData>&
sensor : sensorConfigurations)
{
@@ -263,10 +261,15 @@
redundancy = systemRedundancy;
}
+ constexpr double defaultMaxReading = 25000;
+ constexpr double defaultMinReading = 0;
+ auto limits = std::make_pair(defaultMinReading, defaultMaxReading);
+
+ findLimits(limits, baseConfiguration);
tachSensors[sensorName] = std::make_unique<TachSensor>(
path.string(), baseType, objectServer, dbusConnection,
std::move(presenceSensor), redundancy, io, sensorName,
- std::move(sensorThresholds), *interfacePath);
+ std::move(sensorThresholds), *interfacePath, limits);
}
std::vector<fs::path> pwms;
if (!findFiles(fs::path("/sys/class/hwmon"), R"(pwm\d+)", pwms))