control: Update zone target on startup
To handle restarting of the fan control service, set the zone's target
to what's initialized on one of the fan's target that's included in the
zone.
Change-Id: I88c598e817c1dbbd42d82265b8378dc78d3946d2
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 94a39a8..bd5261c 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -80,6 +80,12 @@
});
if (itZone != _zones.end())
{
+ if (itZone->second->getTarget() != fan.second->getTarget() &&
+ fan.second->getTarget() != 0)
+ {
+ // Update zone target to current target of the fan in the zone
+ itZone->second->setTarget(fan.second->getTarget());
+ }
itZone->second->addFan(std::move(fan.second));
}
}