control: Display locked targets in debug dump
The override_fan_target action can lock individual fan targets to a
value that is different than the zone target that the rest of the fans
are set to.
This change adds those locked target values to the 'zones' section of
the debug dump:
"target_locks": {
"fan0": [
11300
],
"fan3": [
11300
]
}
And when there are no locks:
"target_locks": {}
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I2c4cfa317028db8843d361e79b270d612aacdd87
diff --git a/control/json/fan.hpp b/control/json/fan.hpp
index 124a916..cac8dd2 100644
--- a/control/json/fan.hpp
+++ b/control/json/fan.hpp
@@ -110,6 +110,16 @@
*/
void setTarget(uint64_t target);
+ /**
+ * @brief Returns the fan's locked targets.
+ *
+ * @return - vector of locked targets
+ */
+ const std::vector<uint64_t>& getLockedTargets() const
+ {
+ return _lockedTargets;
+ }
+
private:
/**
* Forces all contained sensors to the target (if this target is the
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index aa81d58..ea308b7 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -535,6 +535,17 @@
output["target_holds"] = _targetHolds;
output["floor_holds"] = _floorHolds;
+ std::map<std::string, std::vector<uint64_t>> lockedTargets;
+ for (const auto& fan : _fans)
+ {
+ const auto& locks = fan->getLockedTargets();
+ if (!locks.empty())
+ {
+ lockedTargets[fan->getName()] = locks;
+ }
+ }
+ output["target_locks"] = lockedTargets;
+
return output;
}