Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -r09e6cf9de34acf18f6e1138bf56ac0edb4821186 -r42ce27a9c940f5fd8a858aca69cbe8dd635ccf8d --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 09e6cf9de34acf18f6e1138bf56ac0edb4821186) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 42ce27a9c940f5fd8a858aca69cbe8dd635ccf8d) @@ -77,7 +77,8 @@ /*********************************************************************//** * @brief * The initBloodPrime function initializes the Blood Prime sub-mode - * module. + * module. Calling this function will reset blood prime and therefore should + * only be called when a new blood prime is due to begin. * @details Inputs: none * @details Outputs: Blood prime sub-mode module initialized. * @return none @@ -115,15 +116,15 @@ /*********************************************************************//** * @brief * The transitionToBloodPrime function prepares for transition to blood prime - * sub-mode. + * sub-mode. This function will reset only what is required for resuming a + * blood prime that was paused (alarm) so if a blood prime is being restarted, + * call the initialize function first to reset everything. * @details Inputs: none * @details Outputs: actuators set for initial state of blood prime sub-mode * @return none *************************************************************************/ void transitionToBloodPrime( void ) { - initBloodPrime(); - // Set valves setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); @@ -135,7 +136,7 @@ stopSyringePump(); // start blood and dialysate inlet pumps - setBloodPumpTargetFlowRate( BLOOD_PRIME_INIT_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + setBloodPumpTargetFlowRate( (U32)bloodPrimeRampFlowRate_mL_min, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater(); @@ -226,10 +227,11 @@ // Has blood prime completed? if ( getBloodPrimeVolume() >= TARGET_BLOOD_PRIME_VOLUME_ML ) { - setBloodIsPrimed( TRUE ); - signalDialInPumpHardStop(); - signalBloodPrimeToDialysis(); - cmdStopDGTrimmerHeater(); + initBloodPrime(); // Reset blood prime so that we start anew next time we transition to this sub-mode + setBloodIsPrimed( TRUE ); // Signal treatment mode that blood prime is completed + signalDialInPumpHardStop(); // Stop dialysate recirculation - dialysis sub-mode will restart dialysate pumps + signalBloodPrimeToDialysis(); // Signal treatment mode that it's time to start dialysis + cmdStopDGTrimmerHeater(); // Stop trimmer heater - dialysis sub-mode will restart as appropriate } #ifndef DISABLE_PUMP_FLOW_CHECKS // Is blood prime taking too long based on set BP rate?