cleanup: reduce scope of variables
Various things caught by cppcheck that are non-critical.
Change-Id: I495453c84bc15788b85036a163ee36b0ac601fa1
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp
index 4a94458..b1c923f 100644
--- a/pid/fancontroller.cpp
+++ b/pid/fancontroller.cpp
@@ -41,7 +41,6 @@
float FanController::input_proc(void)
{
- float sum = 0;
double value = 0;
std::vector<int64_t> values;
std::vector<int64_t>::iterator result;
@@ -62,7 +61,6 @@
if (value > 0)
{
values.push_back(value);
- sum += value;
}
}
}
@@ -76,14 +74,9 @@
value = 0;
if (values.size() > 0)
{
- /* When this is a configuration option in a later update, this code
- * will be updated.
- */
- // value = sum / _inputs.size();
-
/* the fan PID algorithm was unstable with average, and seemed to work
* better with minimum. I had considered making this choice a variable
- * in the configuration, and I will.
+ * in the configuration, and it's a nice-to-have..
*/
result = std::min_element(values.begin(), values.end());
value = *result;