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/stepwisecontroller.cpp b/pid/stepwisecontroller.cpp
index 875a470..b81f8b1 100644
--- a/pid/stepwisecontroller.cpp
+++ b/pid/stepwisecontroller.cpp
@@ -32,11 +32,11 @@
void StepwiseController::process(void)
{
// Get input value
- float input = inputProc();
+ double input = inputProc();
ec::StepwiseInfo info = get_stepwise_info();
- float output = lastOutput;
+ double output = lastOutput;
// Calculate new output if hysteresis allows
if (std::isnan(output))
@@ -81,13 +81,13 @@
return thermal;
}
-float StepwiseController::inputProc(void)
+double StepwiseController::inputProc(void)
{
double value = _owner->getCachedValue(_inputs.at(0));
- return static_cast<float>(value);
+ return value;
}
-void StepwiseController::outputProc(float value)
+void StepwiseController::outputProc(double value)
{
_owner->addRPMSetPoint(value);