Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -re5d1d67106a93a6cd1b5692b586625d715732e2f -r44a100f8e5210a02c23b8fcc4527d8e96d577381 --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision e5d1d67106a93a6cd1b5692b586625d715732e2f) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 44a100f8e5210a02c23b8fcc4527d8e96d577381) @@ -209,9 +209,9 @@ { BLOOD_PRIME_STATE_T result = BLOOD_PRIME_RAMP_STATE; - // update blood prime volume delivered so far + // Update blood prime volume delivered so far cumulativeBloodPrimeVolume_mL += ( getMeasuredBloodFlowRate() * BLOOD_PRIME_FLOW_INTEGRATOR ); - // update independent calculated safety volume delivered so far + // Update independent calculated safety volume delivered so far bloodPrimeMotorCount = u32BiDiffWithWrap( bloodPrimeLastMotorCount, getBloodPumpMotorCount() ) / BP_HALL_EDGE_COUNTS_PER_REV; bloodPrimeVolumeDelivered_Safety = ( (F32)bloodPrimeMotorCount * VOLUME_PER_BP_MOTOR_REV_ML ); // TODO - include upstream pressure compensation to this calc @@ -243,9 +243,14 @@ // ramp blood pump on ramp interval if ( ++bloodPrimeRampControlTimerCtr >= BLOOD_PRIME_RAMPING_INTERVAL ) { + U32 setBPRate = getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); + bloodPrimeRampControlTimerCtr = 0; - bloodPrimeRampFlowRate_mL_min += bloodPrimeRampStep_mL; - setBloodPumpTargetFlowRate( (U32)bloodPrimeRampFlowRate_mL_min, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + if ( bloodPrimeRampFlowRate_mL_min < (F32)setBPRate ) + { + bloodPrimeRampFlowRate_mL_min += bloodPrimeRampStep_mL; + setBloodPumpTargetFlowRate( (U32)bloodPrimeRampFlowRate_mL_min, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + } } }