Add Hysteresis to pid controllers
Add hysteresis to pid controllers to lower pwm changes.
It is defaulted to 0 so it should be transparent
to any controller that choses not to implement it.
This is the same pattern used by the stepwise controller.
Tested-by: Unit tests passed
Change-Id: Ib47114285b0017258b7f77eaf067d310f95a0c60
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 3121623..7d01650 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -428,6 +428,24 @@
VariantToDoubleVisitor(), base.at("SlewNeg"));
info.pidInfo.slew_pos = variant_ns::visit(
VariantToDoubleVisitor(), base.at("SlewPos"));
+ double negativeHysteresis = 0;
+ double positiveHysteresis = 0;
+
+ auto findNeg = base.find("NegativeHysteresis");
+ auto findPos = base.find("PositiveHysteresis");
+ if (findNeg != base.end())
+ {
+ negativeHysteresis = variant_ns::visit(
+ VariantToDoubleVisitor(), findNeg->second);
+ }
+
+ if (findPos != base.end())
+ {
+ positiveHysteresis = variant_ns::visit(
+ VariantToDoubleVisitor(), findPos->second);
+ }
+ info.pidInfo.negativeHysteresis = negativeHysteresis;
+ info.pidInfo.positiveHysteresis = positiveHysteresis;
}
}
auto findStepwise =