diff options
-rw-r--r-- | control/zone.cpp | 15 | ||||
-rw-r--r-- | control/zone.hpp | 18 |
2 files changed, 18 insertions, 15 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index a4a0325..8f11393 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -92,6 +92,16 @@ void Zone::setActiveAllow(const Group* group, bool isActiveAllow) } } +void Zone::setFloor(uint64_t speed) +{ + _floorSpeed = speed; + // Floor speed above target, update target to floor speed + if (_targetSpeed < _floorSpeed) + { + requestSpeedIncrease(_floorSpeed - _targetSpeed); + } +} + void Zone::requestSpeedIncrease(uint64_t targetDelta) { // Only increase speed when delta is higher than @@ -101,11 +111,6 @@ void Zone::requestSpeedIncrease(uint64_t targetDelta) { _targetSpeed = (targetDelta - _incSpeedDelta) + _targetSpeed; _incSpeedDelta = targetDelta; - //TODO Floor speed above target, update target to floor speed - if (_targetSpeed < _floorSpeed) - { - _targetSpeed = _floorSpeed; - } // Target speed can not go above a defined ceiling speed if (_targetSpeed > _ceilingSpeed) { diff --git a/control/zone.hpp b/control/zone.hpp index dc5771c..9786db4 100644 --- a/control/zone.hpp +++ b/control/zone.hpp @@ -128,16 +128,6 @@ class Zone }; /** - * @brief Set the floor speed to the given speed - * - * @param[in] speed - Speed to set the floor to - */ - inline void setFloor(uint64_t speed) - { - _floorSpeed = speed; - }; - - /** * @brief Get the ceiling speed * * @return - The current ceiling speed @@ -192,6 +182,14 @@ class Zone }; /** + * @brief Set the floor speed to the given speed and increase target + * speed to the floor when target is below floor. + * + * @param[in] speed - Speed to set the floor to + */ + void setFloor(uint64_t speed); + + /** * @brief Calculate the requested target speed from the given delta * and increase the fan speeds, not going above the ceiling. * |