Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r399b9fe3684cdae76a0f1913700595d60061075f -r8c8270dec772e34287a3825e6023ebf73b1e1e53 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 399b9fe3684cdae76a0f1913700595d60061075f) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 8c8270dec772e34287a3825e6023ebf73b1e1e53) @@ -730,7 +730,7 @@ // If measured flow if greater than the target flow, adjust the DAC to lower the flow rate tempDACSet = (U32)( ( flowSubLPM * DRP_CONTROL_FLOW_TO_DAC_P_ONLY_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); tempDACSet = ( tempDACSet > drainPumpDACSet ? DRAIN_PUMP_MIN_DAC : tempDACSet ); - drainPumpDACSet -= ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); + drainPumpDACSet -= tempDACSet; } else { @@ -746,15 +746,15 @@ // If the calculated DAC value turned out to be 0, set it to 1 so it changes at least by 1 DAC tempDACSet = (U32)( ( maxPresPSI * DRP_CONTROL_PSI_TO_DAC_P_ONLY_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); tempDACSet = ( tempDACSet > drainPumpDACSet ? DRAIN_PUMP_MIN_DAC : tempDACSet ); - drainPumpDACSet -= ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); + drainPumpDACSet -= tempDACSet; } else if ( ( fabs(pdrSubPSI) > DRP_CONTROL_PRES_TO_MAX_THRESHOLD_PSI ) && ( fabs(ppoSubPSI) > DRP_CONTROL_PRES_TO_MAX_THRESHOLD_PSI ) ) { // If both of the DACs turned out to be less than their maximum pressure limits by more than the specified value, recalculate the // DAC. Using fabs for the subtraction means both pressure subtractions are negative so they are below their limits. // In the calculations use fabs for max pressure because it is negative so it will end of subtracting DAC but it should be adding tempDACSet = (U32)( ( fabs(maxPresPSI) * DRP_CONTROL_PSI_TO_DAC_P_ONLY_TERM ) + FLOAT_TO_INT_ROUNDUP_OFFSET ); - drainPumpDACSet += ( tempDACSet > 0.0F ? tempDACSet : DRP_CONTROL_MIN_DAC_CHANGE ); + drainPumpDACSet += tempDACSet; } }