pid: add helper methods for thermal controller types
Add helper methods for thermal controller types, such as checking if a
string is a supported thermal type and which type that string
corresponds to.
Change-Id: I3c782f5825e7726f264dd186df583bde0a0dc861
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/pid/builder.cpp b/pid/builder.cpp
index 261a165..8fef528 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -94,7 +94,7 @@
info->pidInfo);
zone->addFanPID(std::move(pid));
}
- else if (info->type == "temp" || info->type == "margin")
+ else if (isThermalType(info->type))
{
for (const auto& i : info->inputs)
{
@@ -102,19 +102,9 @@
zone->addThermalInput(i);
}
- ThermalType type;
- if (info->type == "temp")
- {
- type = ThermalType::absolute;
- }
- else
- {
- type = ThermalType::margin;
- }
-
auto pid = ThermalController::createThermalPid(
zone.get(), name, inputs, info->setpoint, info->pidInfo,
- type);
+ getThermalType(info->type));
zone->addThermalPID(std::move(pid));
}