Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -rdb22e9d530c5c9d62b02e6dcc72ed96fb67c165a -r44a100f8e5210a02c23b8fcc4527d8e96d577381 --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision db22e9d530c5c9d62b02e6dcc72ed96fb67c165a) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 44a100f8e5210a02c23b8fcc4527d8e96d577381) @@ -39,10 +39,13 @@ // TODO - get from Systems when available #define TARGET_BLOOD_PRIME_VOLUME_ML 300.0 ///< Target blood prime volume to prime the blood side circuit (in mL). #define MIN_RAMP_TIME_SEC 60 ///< Minimum ramp time for blood prime (in seconds). + +#ifndef DISABLE_PUMP_FLOW_CHECKS /// Maximum blood prime volume measured by independent means (as % of target). static const F32 MAX_BLOOD_PRIME_SAFETY_VOLUME_ML = ( TARGET_BLOOD_PRIME_VOLUME_ML * 1.2 ); /// Minimum blood prime volume measured by independent means (as % of target). static const F32 MIN_BLOOD_PRIME_SAFETY_VOLUME_ML = ( TARGET_BLOOD_PRIME_VOLUME_ML * 0.8 ); +#endif /// Initial flow rate for blood pump when starting blood prime operation. #define BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN 100 @@ -206,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 @@ -240,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 ); + } } }