Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r336c209c89879d63f7d2078124dcbbfb3f01cef9 -r6743b1ba8056267f3a1669a3773c9f9995c0a788 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 336c209c89879d63f7d2078124dcbbfb3f01cef9) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 6743b1ba8056267f3a1669a3773c9f9995c0a788) @@ -509,7 +509,13 @@ */ if ( ( CONCENTRATE_PUMP_MIN_SPEED <= targetSpeed_ml_min ) && ( targetSpeed_ml_min <= CONCENTRATE_PUMP_MAX_SPEED ) ) { - concentratePumps[ pumpId ].pumpTargetSpeed = targetSpeed_ml_min; + F32 targetWithCalMLPM = pow( targetSpeed_ml_min, 4 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].fourthOrderCoeff + + pow( targetSpeed_ml_min, 3 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].thirdOrderCoeff + + pow( targetSpeed_ml_min, 2 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].secondOrderCoeff + + targetSpeed_ml_min * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].gain + + concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].offset; + + concentratePumps[ pumpId ].pumpTargetSpeed = targetWithCalMLPM; } else if ( targetSpeed_ml_min < CONCENTRATE_PUMP_MIN_SPEED ) { @@ -953,14 +959,7 @@ } else if ( FALSE == isPumpPulseWidthOut ) { - F32 speedMLPM = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE * SEC_PER_MIN; - F32 speedMLPMWithCal = pow( speedMLPM, 4 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].fourthOrderCoeff + - pow( speedMLPM, 3 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].thirdOrderCoeff + - pow( speedMLPM, 2 ) * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].secondOrderCoeff + - speedMLPM * concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].gain + - concentratePumpsCalRecord.concentratePumps[ (CAL_DATA_DG_PUMPS_T)pumpId ].offset; - - concentratePumps[ pumpId ].measuredPumpSpeed.data = speedMLPMWithCal; + concentratePumps[ pumpId ].measuredPumpSpeed.data = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE * SEC_PER_MIN; } // If pulse width is out of range capture pump out of range, pumpId and pulse width