Allow derivativeCoeff and DCoefficient optional

To avoid breaking existing configurations in the field, treat the
new "derivativeCoeff" parameter as optional, not mandatory.

This affects both the old JSON parser, and the new D-Bus
entity-manager parser (it's called "DCoefficient" there).

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: Ifcaf47d66e009b48e41b510a2ef1686b8860ad35
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 29f0ccb..02eda38 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -309,6 +309,7 @@
         VariantToDoubleVisitor(), getPIDAttribute(base, "PCoefficient"));
     info.pidInfo.integralCoeff = std::visit(
         VariantToDoubleVisitor(), getPIDAttribute(base, "ICoefficient"));
+    // DCoefficient is below, it is optional, same reason as in buildjson.cpp
     info.pidInfo.feedFwdOffset = std::visit(
         VariantToDoubleVisitor(), getPIDAttribute(base, "FFOffCoefficient"));
     info.pidInfo.feedFwdGain = std::visit(
@@ -325,25 +326,34 @@
         std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewNeg"));
     info.pidInfo.slewPos =
         std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewPos"));
+
     double negativeHysteresis = 0;
     double positiveHysteresis = 0;
+    double derivativeCoeff = 0;
 
     auto findNeg = base.find("NegativeHysteresis");
     auto findPos = base.find("PositiveHysteresis");
+    auto findDerivative = base.find("DCoefficient");
 
     if (findNeg != base.end())
     {
         negativeHysteresis =
             std::visit(VariantToDoubleVisitor(), findNeg->second);
     }
-
     if (findPos != base.end())
     {
         positiveHysteresis =
             std::visit(VariantToDoubleVisitor(), findPos->second);
     }
+    if (findDerivative != base.end())
+    {
+        derivativeCoeff =
+            std::visit(VariantToDoubleVisitor(), findDerivative->second);
+    }
+
     info.pidInfo.negativeHysteresis = negativeHysteresis;
     info.pidInfo.positiveHysteresis = positiveHysteresis;
+    info.pidInfo.derivativeCoeff = derivativeCoeff;
 }
 
 bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,