Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r0b800d3abb747d0f1f3dc8f67777efb9631c18e0 -r57eb6d533a74a212c81cec2baa5246399ffd8cb1 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 0b800d3abb747d0f1f3dc8f67777efb9631c18e0) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 57eb6d533a74a212c81cec2baa5246399ffd8cb1) @@ -410,14 +410,11 @@ *************************************************************************/ void signalBloodPumpHardStop( void ) { - bloodPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; - bloodPumpDirection = MOTOR_DIR_FORWARD; - bloodPumpPWMDutyCyclePct = BP_PWM_ZERO_OFFSET; - bloodPumpState = BLOOD_PUMP_OFF_STATE; - bpControlTimerCounter = 0; targetBloodFlowRate = 0; - resetBloodPumpRPMMovingAverage(); stopBloodPump(); + bloodPumpState = BLOOD_PUMP_OFF_STATE; + bloodPumpPWMDutyCyclePct = BP_PWM_ZERO_OFFSET; + bpControlTimerCounter = 0; resetPIController( PI_CONTROLLER_ID_BLOOD_FLOW, MIN_BLOOD_PUMP_PWM_DUTY_CYCLE ); } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r0b800d3abb747d0f1f3dc8f67777efb9631c18e0 -r57eb6d533a74a212c81cec2baa5246399ffd8cb1 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 0b800d3abb747d0f1f3dc8f67777efb9631c18e0) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 57eb6d533a74a212c81cec2baa5246399ffd8cb1) @@ -406,14 +406,11 @@ *************************************************************************/ void signalDialInPumpHardStop( void ) { - dialInPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; - dialInPumpDirection = MOTOR_DIR_FORWARD; - dialInPumpPWMDutyCyclePct = DIP_PWM_ZERO_OFFSET; - dialInPumpState = DIAL_IN_PUMP_OFF_STATE; - dipControlTimerCounter = 0; targetDialInFlowRate = 0; - resetDialInFlowMovingAverage(); stopDialInPump(); + dialInPumpState = DIAL_IN_PUMP_OFF_STATE; + dialInPumpPWMDutyCyclePct = DIP_PWM_ZERO_OFFSET; + dipControlTimerCounter = 0; resetPIController( PI_CONTROLLER_ID_DIALYSATE_FLOW, MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE ); } Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r0b800d3abb747d0f1f3dc8f67777efb9631c18e0 -r57eb6d533a74a212c81cec2baa5246399ffd8cb1 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 0b800d3abb747d0f1f3dc8f67777efb9631c18e0) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 57eb6d533a74a212c81cec2baa5246399ffd8cb1) @@ -434,14 +434,11 @@ *************************************************************************/ void signalDialOutPumpHardStop( void ) { - dialOutPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; - dialOutPumpDirection = MOTOR_DIR_FORWARD; - dialOutPumpPWMDutyCyclePct = DOP_PWM_ZERO_OFFSET; - dialOutPumpState = DIAL_OUT_PUMP_OFF_STATE; - dopControlSignal = FALSE; lastGivenRate = 0; - resetDialOutFlowMovingAverage(); stopDialOutPump(); + dialOutPumpState = DIAL_OUT_PUMP_OFF_STATE; + dialOutPumpPWMDutyCyclePct = DOP_PWM_ZERO_OFFSET; + resetDialOutFlowMovingAverage(); } /*********************************************************************//** Index: firmware/App/Modes/TreatmentRecirc.c =================================================================== diff -u -r0b800d3abb747d0f1f3dc8f67777efb9631c18e0 -r57eb6d533a74a212c81cec2baa5246399ffd8cb1 --- firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision 0b800d3abb747d0f1f3dc8f67777efb9631c18e0) +++ firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision 57eb6d533a74a212c81cec2baa5246399ffd8cb1) @@ -51,15 +51,13 @@ static BOOL recircBackToTreatmenRequested; ///< Flag indicates user requesting to go back to treatment (confirming re-connected). static BOOL recircResumeRequested; ///< Flag indicates user requesting resumption of re-circulating. static BOOL recircEndTreatmentRequested; ///< Flag indicates user requesting end of treatment. -static BOOL recircStopTreatmentRequested; ///< Flag indicates user requesting end of treatment. // ********** private function prototypes ********** static void resetTreatmentRecircFlags( void ); static void setupForRecirculationState( void ); -static void setupForBloodRecirculationStopState( void ); -static void setupForDialysateRecirculationStopState( void ); +static void setupForRecirculationStopState( void ); static TREATMENT_RECIRC_STATE_T handleRecircDisconnectPatientState( void ); static TREATMENT_RECIRC_STATE_T handleRecircRecircState( void ); @@ -103,7 +101,6 @@ recircBackToTreatmenRequested = FALSE; recircResumeRequested = FALSE; recircEndTreatmentRequested = FALSE; - recircStopTreatmentRequested = ( ( FALSE == isBloodRecircBlocked() ) || ( FALSE == isDialysateRecircBlocked() ) )? FALSE:recircStopTreatmentRequested; } /*********************************************************************//** @@ -120,13 +117,21 @@ setCurrentSubState( (U32)treatmentRecircState ); doorClosedRequired( TRUE, TRUE ); + // Set valves to safe state + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setupForRecirculationStopState(); + // Disable venous bubble detection while recirculating setVenousBubbleDetectionEnabled( FALSE ); // Ensure syringe pump is stopped stopSyringePump(); // Stop air trap leveling control endAirTrapControl(); + // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature + setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + cmdStartDGTrimmerHeater(); // Set user alarm recovery actions allowed in this sub-mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); @@ -145,15 +150,6 @@ *************************************************************************/ static void setupForRecirculationState( void ) { - - // Set valves to safe state, Dialysate bypass - setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); - setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); - - // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature - setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); - cmdStartDGTrimmerHeater(); - // Open VBA and VBV valves to allow flow from saline bag and to patient venous line setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); @@ -163,34 +159,17 @@ /*********************************************************************//** * @brief - * The setupForDialysateRecirculationStopState function sets actuators appropriately + * The setupForRecirculationStopState function sets actuators appropriately * for re-circulation stopped state. * @details Inputs: none - * @details Outputs: DialIn pump stopped and Heater off - * @return none - *************************************************************************/ -static void setupForDialysateRecirculationStopState( void ) -{ - // Stop dialysate side of dialyzer and heating - signalDialInPumpHardStop(); - cmdStopDGTrimmerHeater(); - -} - -/*********************************************************************//** - * @brief - * The setupForBloodRecirculationStopState function sets actuators appropriately - * for re-circulation stopped state. - * @details Inputs: none * @details Outputs: Blood pump stopped, arterial and venous lines closed, - * and air trap leveling control is stopped. DialIn Pump and Heater off + * and air trap leveling control is stopped. * @return none *************************************************************************/ -static void setupForBloodRecirculationStopState( void ) +static void setupForRecirculationStopState( void ) { // Stop blood pump signalBloodPumpHardStop(); - // Close arterial and venous lines setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); @@ -282,19 +261,19 @@ // Is alarm stop? if ( TRUE == doesAlarmStatusIndicateStop() ) { - setupForBloodRecirculationStopState(); + setupForRecirculationStopState(); result = TREATMENT_RECIRC_STOPPED_STATE; } // Is user reconnect requested? else if ( TRUE == recircReconnectRequested ) { - setupForBloodRecirculationStopState(); + setupForRecirculationStopState(); result = TREATMENT_RECIRC_RECONNECT_PATIENT_STATE; } // Is end treatment requested? else if ( TRUE == recircEndTreatmentRequested ) { - setupForBloodRecirculationStopState(); + setupForRecirculationStopState(); signalEndTreatment(); // signal end Tx sub-mode } @@ -313,14 +292,6 @@ { TREATMENT_RECIRC_STATE_T result = TREATMENT_RECIRC_STOPPED_STATE; - // Both blocked and not in stopped state - if ( ( FALSE == recircStopTreatmentRequested ) && ( TRUE == isDialysateRecircBlocked() ) && ( TRUE == isBloodRecircBlocked() ) ) - { - setupForBloodRecirculationStopState(); - setupForDialysateRecirculationStopState(); - recircStopTreatmentRequested = TRUE; - } - // Is end treatment requested? if ( TRUE == recircEndTreatmentRequested ) { @@ -356,7 +327,7 @@ // Is end treatment requested? else if ( TRUE == recircEndTreatmentRequested ) { - setupForBloodRecirculationStopState(); + setupForRecirculationStopState(); signalEndTreatment(); // signal end Tx sub-mode } // Is re-circ resume requested?