Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -ra5b2f7f58ed39bd84d2ba6986850cae7feddfeb4 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision a5b2f7f58ed39bd84d2ba6986850cae7feddfeb4) @@ -15,6 +15,7 @@ * ***************************************************************************/ +#include "AirTrap.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" @@ -52,9 +53,8 @@ /*********************************************************************//** * @brief * The initStandbyMode function initializes the Standby Mode module. - * @details - * Inputs : none - * Outputs : Standby Mode module initialized. + * @details Inputs: none + * @details Outputs: Standby Mode module initialized. * @return none *************************************************************************/ void initStandbyMode( void ) @@ -66,9 +66,8 @@ /*********************************************************************//** * @brief * The transitionToStandbyMode function prepares for transition to standby mode. - * @details - * Inputs : none - * Outputs : Standby Mode module re-initialized, DG interface initialized, + * @details Inputs: none + * @details Outputs: Standby Mode module re-initialized, DG interface initialized, * blood & dialysate pumps shut off. * @return none *************************************************************************/ @@ -77,14 +76,12 @@ // re-initialize when transitioning to standby mode initStandbyMode(); initDGInterface(); + resetAirTrap(); // pumps should be off setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); -#ifdef EMC_TEST_BUILD - enableValvesPIDControl(0); // enable valves -#endif #ifdef RM46_EVAL_BOARD_TARGET start = getMSTimerCount(); #endif @@ -93,9 +90,8 @@ /*********************************************************************//** * @brief * The execStandbyMode function executes the Standby Mode state machine. - * @details - * Inputs : currentStandbyState - * Outputs : currentStandbyState + * @details Inputs: currentStandbyState + * @details Outputs: currentStandbyState * @return current state (sub-mode) *************************************************************************/ U32 execStandbyMode( void ) @@ -116,9 +112,9 @@ // temporary test code - TODO - remove later if ( TRUE == isDGCommunicating() ) { - //homeBloodPump(); - //homeDialInPump(); - //homeDialOutPump(); + homeBloodPump(); + homeDialInPump(); + homeDialOutPump(); cmdSetDGDialysateTargetTemps( 39.0, 37.0 ); cmdSetDGActiveReservoir( DG_RESERVOIR_2 ); cmdStartDG(); @@ -183,9 +179,14 @@ requestNewOperationMode( MODE_TPAR ); treatStartReqReceived = FALSE; } +#ifdef DISABLE_UI_TREATMENT_WORKFLOW // TODO - test code if ( TRUE == stop ) +#else + if ( TRUE == treatStartReqReceived ) +#endif { + treatStartReqReceived = FALSE; if ( DG_MODE_CIRC == dgOpMode ) { if ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == dgSubMode ) @@ -213,6 +214,9 @@ homeBloodPump(); homeDialInPump(); homeDialOutPump(); +#ifdef EMC_TEST_BUILD + startAirTrapControl(); +#endif break; case STANDBY_WAIT_FOR_TREATMENT_STATE: @@ -224,30 +228,36 @@ // TODO - test code if ( TRUE == stop ) { + treatStartReqReceived = FALSE; + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + requestNewOperationMode( MODE_TPAR ); #ifdef EMC_TEST_BUILD if ( stop != button_state ) { toggle = INC_WRAP( toggle, 0, 3 ); switch ( toggle ) { case 0: // pumps and valves off - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; case 1: // pumps on, valves off - setBloodPumpTargetFlowRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + setBloodPumpTargetFlowRate( 200, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialOutPumpTargetRate( 500, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); break; case 2: // pumps on, valves on - setDialyzerInletValvePosition( 12000 ); - setDialyzerOutletValvePosition( 12000 ); - setVenousBloodValvePosition( 12000 ); - setArterialBloodValvePosition( 12000 ); + setValvePosition( VDI, VALVE_POSITION_B_OPEN ); + setValvePosition( VDO, VALVE_POSITION_B_OPEN ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); break; case 3: // pumps off, valves on @@ -261,10 +271,10 @@ setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); - setDialyzerInletValvePosition( 0 ); - setDialyzerOutletValvePosition( 0 ); - setVenousBloodValvePosition( 0 ); - setArterialBloodValvePosition( 0 ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); break; } } @@ -296,9 +306,8 @@ * @brief * The signalUserStartingTreatment function handles user initiation of a * treatment. - * @details - * Inputs : none - * Outputs : requested mode transition to treatment parameters mode + * @details Inputs: none + * @details Outputs: requested mode transition to treatment parameters mode * @return TRUE if signal accepted, FALSE if not *************************************************************************/ BOOL signalUserStartingTreatment( void )