Index: firmware/App/Modes/StateTxBloodPrime.c =================================================================== diff -u -r2fe1bfe77e53e5b92dae1b89c726c59b7b95939f -rcd719697d06af0827efb3435753e2e959f311cc8 --- firmware/App/Modes/StateTxBloodPrime.c (.../StateTxBloodPrime.c) (revision 2fe1bfe77e53e5b92dae1b89c726c59b7b95939f) +++ firmware/App/Modes/StateTxBloodPrime.c (.../StateTxBloodPrime.c) (revision cd719697d06af0827efb3435753e2e959f311cc8) @@ -72,11 +72,11 @@ /*********************************************************************//** * @brief - * The initBloodPrime function initializes the Blood Prime sub-mode - * module. Calling this function will reset blood prime and therefore should + * The initBloodPrime function initializes the Blood Prime state + * unit. 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. + * @details Outputs: Blood prime state unit initialized. * @return none *************************************************************************/ void initBloodPrime( void ) @@ -108,42 +108,43 @@ /*********************************************************************//** * @brief * The transitionToBloodPrime function prepares for transition to blood prime - * sub-mode. This function will reset only what is required for resuming a + * state. 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 + * @details Outputs: actuators set for initial state of blood prime state * @return none *************************************************************************/ void transitionToBloodPrime( void ) { + // Set user alarm recovery actions allowed in this state + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); + + // Require BP door to be closed during this state doorClosedRequired( TRUE, TRUE ); - // Set valves + // Set pinch valves setValvePosition( H1_VALV, VALVE_POSITION_B_OPEN ); // set arterial valve to pump blood from patient setValvePosition( H19_VALV, VALVE_POSITION_B_OPEN ); // set venous valve to open, allowing blood to return to patient - // Start air trap control - startAirTrapControl(); - - // Set valves + // Set air trap valves set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); + // Start air trap control + startAirTrapControl(); - // Ensure dialysate outlet and Heparin pumps are stopped - //signalDialOutPumpHardStop(); + // Ensure Heparin pump is stopped //stopSyringePump(); - // start blood and dialysate inlet pumps + // start blood pump setBloodPumpTargetFlowRate( (U32)bloodPrimeRampFlowRate_mL_min, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setCurrentSubState( (U32)bloodPrimeState ); + // TODO - direct DD to bypass dialysate and perform no ultrafiltration - // Set user alarm recovery actions allowed in this sub-mode - setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); - setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); - setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); + setCurrentSubState( (U32)bloodPrimeState ); } /*********************************************************************//** @@ -180,7 +181,7 @@ /*********************************************************************//** * @brief - * The execBloodPrime function executes the Blood Prime sub-mode state machine. + * The execBloodPrime function executes the Blood Prime state machine. * @details Inputs: bloodPrimeState * @details Outputs: bloodPrimeState * @return none @@ -252,7 +253,7 @@ /*********************************************************************//** * @brief * The getCurrentBloodPrimeState function returns the current state of the - * blood prime sub-mode. + * blood prime state. * @details Inputs: bloodPrimeState * @details Outputs: none * @return bloodPrimeState