Skip to content

Commit 2541f99

Browse files
committed
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
1 parent bf8e56f commit 2541f99

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

control/json/fan.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ class Fan : public ConfigBase
110110
*/
111111
void setTarget(uint64_t target);
112112

113+
/**
114+
* @brief Returns the fan's locked targets.
115+
*
116+
* @return - vector of locked targets
117+
*/
118+
const std::vector<uint64_t>& getLockedTargets() const
119+
{
120+
return _lockedTargets;
121+
}
122+
113123
private:
114124
/**
115125
* Forces all contained sensors to the target (if this target is the

control/json/zone.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,17 @@ json Zone::dump() const
535535
output["target_holds"] = _targetHolds;
536536
output["floor_holds"] = _floorHolds;
537537

538+
std::map<std::string, std::vector<uint64_t>> lockedTargets;
539+
for (const auto& fan : _fans)
540+
{
541+
const auto& locks = fan->getLockedTargets();
542+
if (!locks.empty())
543+
{
544+
lockedTargets[fan->getName()] = locks;
545+
}
546+
}
547+
output["target_locks"] = lockedTargets;
548+
538549
return output;
539550
}
540551

0 commit comments

Comments
 (0)