Add stepwise controller

This adds the ability to use stepwise curves alongside
pid control. This creates a base controller class that
pidcontroller and stepwise controller inherit from.

Note: Hysteresis to come in follow-on patch

Tested-by:
Created a stepwise controller and noticed that when it
crossed a threshold that it contributed to the pwm setting.

Change-Id: I6cf842f80eaccafc905d620970afe91e2092d568
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/pid/builder.cpp b/pid/builder.cpp
index 8ffa77c..e98ba22 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -17,7 +17,9 @@
 #include "pid/builder.hpp"
 
 #include "conf.hpp"
+#include "pid/controller.hpp"
 #include "pid/fancontroller.hpp"
+#include "pid/stepwisecontroller.hpp"
 #include "pid/thermalcontroller.hpp"
 
 #include <iostream>
@@ -89,7 +91,7 @@
                 }
 
                 auto pid = FanController::CreateFanPid(zone.get(), name, inputs,
-                                                       info->info);
+                                                       info->pidInfo);
                 zone->addFanPID(std::move(pid));
             }
             else if (info->type == "temp" || info->type == "margin")
@@ -101,9 +103,21 @@
                 }
 
                 auto pid = ThermalController::CreateThermalPid(
-                    zone.get(), name, inputs, info->setpoint, info->info);
+                    zone.get(), name, inputs, info->setpoint, info->pidInfo);
+
                 zone->addThermalPID(std::move(pid));
             }
+            else if (info->type == "stepwise")
+            {
+                for (auto& i : info->inputs)
+                {
+                    inputs.push_back(i);
+                    zone->addThermalInput(i);
+                }
+                auto stepwise = StepwiseController::CreateStepwiseController(
+                    zone.get(), name, inputs, info->stepwiseInfo);
+                zone->addThermalPID(std::move(stepwise));
+            }
 
             std::cerr << "inputs: ";
             for (auto& i : inputs)