Program for the water play project for the course Software Testing Practical 2016 given at the VU University
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: PIDController.cpp
- Revision:
- 69:6138d4e0410e
- Parent:
- 65:b277b4067d4a
- Child:
- 70:642153418c6e
--- a/PIDController.cpp Mon Jun 20 12:48:42 2016 +0000 +++ b/PIDController.cpp Mon Jun 20 13:28:21 2016 +0000 @@ -33,7 +33,7 @@ } else if(s <= SALT_MIN_UNDESIRED) { float ml = this->getMlSaltyWater(s_in_grams, this->proximity->getValue()); - int ml_int = static_cast<int>(ml); + int ml_int = std::max(static_cast<int>(ml), 30); cout << "PIDCONTROLLER: need to pump " << ml_int << " (" << ml << ")" << " ml of salty water\r\n"; @@ -42,7 +42,7 @@ } else if(s >= SALT_MAX_UNDESIRED) { float ml = this->getMlFreshWater(s, this->proximity->getValue()); - int ml_int = static_cast<int>(ml); + int ml_int = std::max(static_cast<int>(ml), 30); cout << "PIDCONTROLLER: need to pump " << ml_int << " (" << ml << ")" << " ml of fresh water\r\n";