diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-10-17 10:35:20 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-11-17 13:14:11 -0600 |
commit | 98726c4585d6743c0948ed0140835e438de1df79 (patch) | |
tree | 1404b5f2256972d96fb940687808f27f187a272d /control/zone.cpp | |
parent | 9df7475003a090aa104f033270533f106e004c57 (diff) | |
download | phosphor-fan-presence-98726c4585d6743c0948ed0140835e438de1df79.tar.gz phosphor-fan-presence-98726c4585d6743c0948ed0140835e438de1df79.zip |
Set floor to default on missing owner action
An action to set the fan floor speed to the defined default fan floor
speed when any services associated to a given group of sensors have
terminated. Once those services are functional and providing the
sensors, the fan floor is allowed to be set normally again.
i.e.) For fan floor speeds based on an ambient sensor, if the service
providing the ambient temperature value from the sensor terminates, the
default floor for the zone is used as the fan floor speed.
Change-Id: I2d58cc9b31051e6b8e5e798c0a736f58f5efe5b1
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r-- | control/zone.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index 018f594..418b3ba 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -147,11 +147,19 @@ void Zone::setServiceOwner(const Group* group, void Zone::setFloor(uint64_t speed) { - _floorSpeed = speed; - // Floor speed above target, update target to floor speed - if (_targetSpeed < _floorSpeed) + // Check all entries are set to allow floor to be set + auto pred = [](auto const& entry) {return entry.second;}; + auto setFloor = std::all_of(_floorChange.begin(), + _floorChange.end(), + pred); + if (setFloor) { - requestSpeedIncrease(_floorSpeed - _targetSpeed); + _floorSpeed = speed; + // Floor speed above target, update target to floor speed + if (_targetSpeed < _floorSpeed) + { + requestSpeedIncrease(_floorSpeed - _targetSpeed); + } } } |