Move all floats to doubles
The code was developed initially around a pid loop implemented using
floats. Therefore, the code was converting back and forth between
double for sensor values as inputs and outputs from this PID loop.
Change-Id: I2d2919e1165103040729c9f16bb84fde3dd6b81b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/zone.cpp b/pid/zone.cpp
index f04a68d..cc135bf 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -35,7 +35,7 @@
using tstamp = std::chrono::high_resolution_clock::time_point;
using namespace std::literals::chrono_literals;
-float PIDZone::getMaxRPMRequest(void) const
+double PIDZone::getMaxRPMRequest(void) const
{
return _maximumRPMSetPt;
}
@@ -61,7 +61,7 @@
return _zoneId;
}
-void PIDZone::addRPMSetPoint(float setpoint)
+void PIDZone::addRPMSetPoint(double setpoint)
{
_RPMSetPoints.push_back(setpoint);
}
@@ -71,12 +71,12 @@
_RPMSetPoints.clear();
}
-float PIDZone::getFailSafePercent(void) const
+double PIDZone::getFailSafePercent(void) const
{
return _failSafePercent;
}
-float PIDZone::getMinThermalRPMSetpoint(void) const
+double PIDZone::getMinThermalRPMSetpoint(void) const
{
return _minThermalRpmSetPt;
}
@@ -108,8 +108,8 @@
void PIDZone::determineMaxRPMRequest(void)
{
- float max = 0;
- std::vector<float>::iterator result;
+ double max = 0;
+ std::vector<double>::iterator result;
if (_RPMSetPoints.size() > 0)
{
@@ -140,7 +140,7 @@
ifs >> value;
/* expecting RPM set-point, not pwm% */
- max = static_cast<float>(value);
+ max = static_cast<double>(value);
}
}
catch (const std::exception& e)