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/Utils.cpp b/src/Utils.cpp
index 15fce73..e4de9e0 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -156,3 +156,26 @@
 
     return powerStatusOn;
 }
+
+// replaces limits if MinReading and MaxReading are found.
+void findLimits(std::pair<double, double>& limits,
+                const SensorBaseConfiguration* data)
+{
+    if (!data)
+    {
+        return;
+    }
+    auto maxFind = data->second.find("MaxReading");
+    auto minFind = data->second.find("MinReading");
+
+    if (minFind != data->second.end())
+    {
+        limits.first = sdbusplus::message::variant_ns::visit(
+            VariantToDoubleVisitor(), minFind->second);
+    }
+    if (maxFind != data->second.end())
+    {
+        limits.second = sdbusplus::message::variant_ns::visit(
+            VariantToDoubleVisitor(), maxFind->second);
+    }
+}
\ No newline at end of file