Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -rc20dacdc80635ee4370867e97aba9b00f765ae7e -r7d6cf3f2f922695b708bfb5c3dd67444ff3537bf --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision c20dacdc80635ee4370867e97aba9b00f765ae7e) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 7d6cf3f2f922695b708bfb5c3dd67444ff3537bf) @@ -991,19 +991,20 @@ *************************************************************************/ static void monitorPumpSpeed( CONCENTRATE_PUMPS_T pumpId, ALARM_ID_T alarm ) { - F32 cpTargetSpeed = concentratePumps[ pumpId ].currentPumpSpeed; - F32 cpError = fabs( getMeasuredPumpSpeedMLPM( pumpId ) - cpTargetSpeed ); + // NOTE: make all the values absolute to cover both negative and positive target/measured speeds + F32 cpTargetSpeed = fabs( concentratePumps[ pumpId ].currentPumpSpeed ); + F32 cpMeasSpeed = fabs( getMeasuredPumpSpeedMLPM( pumpId ) ); + F32 cpError = fabs( cpMeasSpeed - cpTargetSpeed ); BOOL isCpSpeedOut = FALSE; F32 tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM; DG_OP_MODE_T opMode = getCurrentOperationMode(); - if ( fabs( cpTargetSpeed ) > CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM ) + if ( cpTargetSpeed > CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM ) { // Check if the pump is not in the off state and if it is not and greater than the minimum threshold, divide the error // to target speed. If the pump is off the target speed is 0 so the speed check is done differently // The speed tolerance is looser in heat disinfect and flush than the rest of the modes that the concentrate pump are running. - // NOTE: the target speed should be fabs to check the negative target speed too. Negative speed is used in cleaning modes - cpError = cpError / fabs( cpTargetSpeed ); + cpError = cpError / cpTargetSpeed; tolerance = CONCENTRATE_PUMP_TX_SPD_OUT_OF_RANGE_TOL_PCT; if ( ( DG_MODE_HEAT == opMode ) || ( DG_MODE_FLUS == opMode ) )