Set target speed according to floor speed change
When the floor speed updates, a request to increase the target speed
should be made when the target is now below the floor speed.
Change-Id: Ib622bc717a952ef0c0703cbff40a4dc14b213416
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
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::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 @@
{
_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)
{