cpusensor: change Min/Max values for power

minValue and maxValue are currently hardcoded for all cpusensors to
-128 and 127 respectively. There is no sense to have negative values for
power sensors but CPU power consumption can be higher than 127W.
Change Min/Max to 0...511 for power sensors.

Tested: busctl introspect xyz.openbmc_project.CPUSensor /xyz/openbmc_project/sensors/power/Average_Power_CPU0
 xyz.openbmc_project.Sensor.Value interface --                                        -
 .MaxValue                        property  d 511                                      emits-change
 .MinValue                        property  d 0                                        emits-change
 .Unit                            property  s "xyz.openbmc_project.Sensor.Value.Unit.… emits-change
 .Value                           property  d 64.393                                   emits-change writable

Signed-off-by: Andrei Kartashev <a.kartashev@yadro.com>
Change-Id: I0dafdd657194b1b4d709ce093b658a89120f81f9
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index a3045c5..9dd8b23 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -31,8 +31,6 @@
     static constexpr unsigned int sensorScaleFactor = 1000;
     static constexpr unsigned int sensorPollMs = 1000;
     static constexpr size_t warnAfterErrorCount = 10;
-    static constexpr double maxReading = 127;
-    static constexpr double minReading = -128;
     static constexpr const char* labelTcontrol = "Tcontrol";
 
   private:
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 2356821..ea56d03 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -43,8 +43,8 @@
                      const std::string& sensorConfiguration, int cpuId,
                      bool show, double dtsOffset) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
-           std::move(_thresholds), sensorConfiguration, objectType, maxReading,
-           minReading, conn, PowerState::on),
+           std::move(_thresholds), sensorConfiguration, objectType, 0, 0, conn,
+           PowerState::on),
     objServer(objectServer), inputDev(io), waitTimer(io), path(path),
     privTcontrol(std::numeric_limits<double>::quiet_NaN()),
     dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs),
@@ -61,11 +61,15 @@
             if (type.compare("power") == 0)
             {
                 interfacePath = "/xyz/openbmc_project/sensors/power/" + name;
+                minValue = 0;
+                maxValue = 511;
             }
             else
             {
                 interfacePath =
                     "/xyz/openbmc_project/sensors/temperature/" + name;
+                minValue = -128;
+                maxValue = 127;
             }
 
             sensorInterface = objectServer.add_interface(