diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-06-29 11:43:45 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-07-06 17:25:12 -0500 |
commit | a956184bfe6afa6803fc4456eea1f5b6742d8f80 (patch) | |
tree | 490a45ef4feb71435d28860c4758c8a416318137 /control/zone.cpp | |
parent | b4a7cb99bb82f602d3cff848a1f14ade1da2ddb5 (diff) | |
download | phosphor-fan-presence-a956184bfe6afa6803fc4456eea1f5b6742d8f80.tar.gz phosphor-fan-presence-a956184bfe6afa6803fc4456eea1f5b6742d8f80.zip |
Add increase & decrease timer values in seconds
Support setting the increase delay time(in seconds) for each zone from
the zone yaml file. Speed increases use a delay type timer where the
amount of time given delays additional increase requests from happening
until the fans within the zone reach the highest net increase in speeds.
Support setting the decrease interval time(in seconds) for each zone
from the zone yaml file. Since decreasing is done on an interval, a
decrease interval time of zero disables the decrease interval timer
causing no decreases in speed to occur. Speed decreases use an interval
type timer to decrease the fan speeds within the zone when no speed
increase requests exist on the given time interval.
Change-Id: I88334a313b6e2820b768fa7e3f1cb65887f29258
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r-- | control/zone.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index 8f11393..93a616a 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -42,6 +42,8 @@ Zone::Zone(Mode mode, _zoneNum(std::get<zoneNumPos>(def)), _defFloorSpeed(std::get<floorSpeedPos>(def)), _defCeilingSpeed(std::get<fullSpeedPos>(def)), + _incDelay(std::get<incDelayPos>(def)), + _decInterval(std::get<decIntervalPos>(def)), _incTimer(events, [this](){ this->incTimerExpired(); }), _decTimer(events, [this](){ this->decTimerExpired(); }) { @@ -57,10 +59,9 @@ Zone::Zone(Mode mode, { initEvents(def); // Start timer for fan speed decreases - if (!_decTimer.running()) + if (!_decTimer.running() && _decInterval != seconds::zero()) { - //TODO Update time value to what's given in zones yaml - _decTimer.start(seconds(30), + _decTimer.start(_decInterval, phosphor::fan::util::Timer::TimerType::repeating); } } @@ -123,8 +124,7 @@ void Zone::requestSpeedIncrease(uint64_t targetDelta) } setSpeed(_targetSpeed); // Start timer countdown for fan speed increase - //TODO Update time value to what's given in zones yaml - _incTimer.start(seconds(5), + _incTimer.start(_incDelay, phosphor::fan::util::Timer::TimerType::oneshot); } } |