Fix: Move overriding logic to base sensor class

Instead of having the overridden value check inside each
sensor type, move the same to sensor base class, so that
any future addition of new sensor model, will be able to
inherit this feature automatically

Tested:
1. Verified the behaviour of overriden value by setting
the Value property.
2. restarting the sensor initializes the value back correctly

Change-Id: Iddf280cafcf6d9299e1edc13b942683bf60ea89b
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 607eb3d..2a414da 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -30,20 +30,20 @@
     std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
     std::shared_ptr<sdbusplus::asio::dbus_interface> association;
     double value = std::numeric_limits<double>::quiet_NaN();
-    double overriddenValue = std::numeric_limits<double>::quiet_NaN();
     bool overridenState = false;
     bool internalSet = false;
 
     int setSensorValue(const double& newValue, double& oldValue)
     {
-        if (internalSet)
+        if (!internalSet)
         {
-            internalSet = false;
             oldValue = newValue;
-            return 1;
+            overridenState = true;
         }
-        overriddenValue = newValue;
-        overridenState = true;
+        else if (!overridenState)
+        {
+            oldValue = newValue;
+        }
         return 1;
     }