test: pid: fancontroller
Adds unit-tests for the fancontroller.
Bugfix: set point not initialized to 0, although bug has no impact.
Tested: Ran on quanta-q71l board and it behaved as expected.
Change-Id: I516833d8c9ed806b765ff9333801f3d57932a17b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp
index c2dee74..9407689 100644
--- a/pid/fancontroller.cpp
+++ b/pid/fancontroller.cpp
@@ -27,6 +27,10 @@
std::vector<std::string>& inputs,
ec::pidinfo initial)
{
+ if (inputs.size() == 0)
+ {
+ return nullptr;
+ }
auto fan = std::make_unique<FanController>(id, inputs, owner);
ec::pid_info_t* info = fan->get_pid_info();
@@ -68,6 +72,8 @@
throw;
}
+ /* Reset the value from the above loop. */
+ value = 0;
if (values.size() > 0)
{
/* When this is a configuration option in a later update, this code