Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -rb8f8a3fdf24e26c0268b3f566061d8c6d7cd44e7 -r5d182b5d0c3ec20904cde60dc950d57948e4b189 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision b8f8a3fdf24e26c0268b3f566061d8c6d7cd44e7) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 5d182b5d0c3ec20904cde60dc950d57948e4b189) @@ -39,16 +39,16 @@ #define EMPTY_RESERVOIR_VOLUME_ML 0 ///< Empty reservoir volume in ml. #define DIP_FLUSH_FLOW_RATE_ML_MIN 150 ///< Dialysate inlet pump flow rate during flush in mL/min. -#define LOAD_CELL_VOLUME_NOISE_TOLERANCE_GRAMS 5.0 ///< Allowed tolerance on load cell readings when empty in grams. +#define LOAD_CELL_VOLUME_NOISE_TOLERANCE_GRAMS 10.0 ///< Allowed tolerance on load cell readings when empty in grams. -/// Post-Treatmen de-prime state machine. -typedef enum De_Prime_States +/// Post-Treatment drain reservoirs state machine. +typedef enum Drain_States { - DE_PRIME_DRAIN_RESERVOIR_ONE_STATE = 0, ///< De-prime drain reservoir one state. - DE_PRIME_DRAIN_RESERVOIR_TWO_STATE, ///< De-prime drain reservoir two state. - DE_PRIME_COMPLETE_STATE, ///< De-prime complete state. - NUM_OF_DE_PRIME_STATES ///< Number of de-prime states. -} DE_PRIME_STATE_T; + DRAIN_RESERVOIR_ONE_STATE = 0, ///< Drain reservoir one state. + DRAIN_RESERVOIR_TWO_STATE, ///< Drain reservoir two state. + DRAIN_COMPLETE_STATE, ///< Drain complete state. + NUM_OF_DRAIN_STATES ///< Number of drain states. +} DRAIN_STATE_T; // ********** private data ********** @@ -58,19 +58,19 @@ static BOOL isDrainStarted = FALSE; ///< Flag indicates a drain operation has been started. static HD_POST_TREATMENT_STATE_T currentPostTreatmentState; ///< Current state of post-treatment mode state machine. -static DE_PRIME_STATE_T currentDePrimeState; ///< Current de-prime sub-mode state. +static DRAIN_STATE_T currentDrainReservoirState; ///< Current drain reservoir state. // ********** private function prototypes ********** static HD_POST_TREATMENT_STATE_T handlePostTreatmentPatientDisconnectionState( void ); -static HD_POST_TREATMENT_STATE_T handlePostTreatmentDePrimeState( void ); +static HD_POST_TREATMENT_STATE_T handlePostTreatmentDrainReservoirsState( void ); static HD_POST_TREATMENT_STATE_T handlePostTreatmentVerifyState( void ); -static void execDePrime( void ); +static void execDrainReservoirs( void ); static BOOL switchReservoirCompleted( DG_RESERVOIR_ID_T activeRes ); static BOOL startDrainCompleted( void ); -static DE_PRIME_STATE_T handleDePrimeDrainReservoirOneState( void ); -static DE_PRIME_STATE_T handleDePrimeDrainReservoirTwoState( void ); +static DRAIN_STATE_T handleDrainReservoirOneState( void ); +static DRAIN_STATE_T handleDrainReservoirTwoState( void ); /*********************************************************************//** * @brief @@ -85,7 +85,7 @@ disposableRemovalConfirmed = FALSE; isDrainStarted = FALSE; currentPostTreatmentState = HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE; - currentDePrimeState = DE_PRIME_DRAIN_RESERVOIR_ONE_STATE; + currentDrainReservoirState = DRAIN_RESERVOIR_ONE_STATE; } /*********************************************************************//** @@ -111,7 +111,6 @@ cmdSetDGActiveReservoir( DG_RESERVOIR_2 ); cmdStopDGTrimmerHeater(); - setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); @@ -143,8 +142,8 @@ currentPostTreatmentState = handlePostTreatmentPatientDisconnectionState(); break; - case HD_POST_TREATMENT_DE_PRIME_STATE: - currentPostTreatmentState = handlePostTreatmentDePrimeState(); + case HD_POST_TREATMENT_DRAIN_RESERVOIRS_STATE: + currentPostTreatmentState = handlePostTreatmentDrainReservoirsState(); break; case HD_POST_TREATMENT_VERIFY_STATE: @@ -218,7 +217,7 @@ if ( TRUE == patientDisconnectionConfirmed ) { patientDisconnectionConfirmed = FALSE; - state = HD_POST_TREATMENT_DE_PRIME_STATE; + state = HD_POST_TREATMENT_DRAIN_RESERVOIRS_STATE; for ( valve = VDI; valve < NUM_OF_VALVES; ++valve ) { @@ -246,19 +245,19 @@ /*********************************************************************//** * @brief - * The handlePostTreatmentDePrimeState function executes de-prime operation - * sub-mode state machine and transition to next state once completed. - * @details Inputs: currentDePrimeState - * @details Outputs: executed de-prime operation state machine. + * The handlePostTreatmentDrainReservoirsState function executes drain reservoirs + * operation state machine and transition to next state once completed. + * @details Inputs: currentDrainReservoirState + * @details Outputs: executed drain reservoirs operation state machine. * @return current state (sub-mode) *************************************************************************/ -static HD_POST_TREATMENT_STATE_T handlePostTreatmentDePrimeState( void ) +static HD_POST_TREATMENT_STATE_T handlePostTreatmentDrainReservoirsState( void ) { - HD_POST_TREATMENT_STATE_T state = HD_POST_TREATMENT_DE_PRIME_STATE; + HD_POST_TREATMENT_STATE_T state = HD_POST_TREATMENT_DRAIN_RESERVOIRS_STATE; - execDePrime(); + execDrainReservoirs(); - if ( DE_PRIME_COMPLETE_STATE == currentDePrimeState ) + if ( DRAIN_COMPLETE_STATE == currentDrainReservoirState ) { if ( TRUE == disposableRemovalConfirmed ) { @@ -314,24 +313,24 @@ /*********************************************************************//** * @brief - * The execDePrime function executes the De-Prime sub-mode state machine. - * @details Inputs: none - * @details Outputs: none + * The execDrainReservoirs function executes the drain reservoirs operation. + * @details Inputs: currentDrainReservoirState + * @details Outputs: currentDrainReservoirState * @return current state *************************************************************************/ -static void execDePrime( void ) +static void execDrainReservoirs( void ) { - switch ( currentDePrimeState ) + switch ( currentDrainReservoirState ) { - case DE_PRIME_DRAIN_RESERVOIR_ONE_STATE: - currentDePrimeState = handleDePrimeDrainReservoirOneState(); + case DRAIN_RESERVOIR_ONE_STATE: + currentDrainReservoirState = handleDrainReservoirOneState(); break; - case DE_PRIME_DRAIN_RESERVOIR_TWO_STATE: - currentDePrimeState = handleDePrimeDrainReservoirTwoState(); + case DRAIN_RESERVOIR_TWO_STATE: + currentDrainReservoirState = handleDrainReservoirTwoState(); break; - case DE_PRIME_COMPLETE_STATE: + case DRAIN_COMPLETE_STATE: break; default: @@ -397,15 +396,15 @@ /*********************************************************************//** * @brief - * The handleDePrimeDrainReservoirOneState function sends command to DG to + * The handleDrainReservoirOneState function sends command to DG to * drain reservoir one. * @details Inputs: none * @details Outputs: drained reservoir one * @return current state (sub-mode) *************************************************************************/ -static DE_PRIME_STATE_T handleDePrimeDrainReservoirOneState( void ) +static DRAIN_STATE_T handleDrainReservoirOneState( void ) { - DE_PRIME_STATE_T state = DE_PRIME_DRAIN_RESERVOIR_ONE_STATE; + DRAIN_STATE_T state = DRAIN_RESERVOIR_ONE_STATE; if ( ( DG_MODE_CIRC == getDGOpMode() ) && ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == getDGSubMode() ) ) { @@ -426,23 +425,23 @@ if ( ( TRUE == isDrainStarted ) && ( DG_MODE_CIRC == getDGOpMode() ) ) { isDrainStarted = FALSE; - state = DE_PRIME_DRAIN_RESERVOIR_TWO_STATE; + state = DRAIN_RESERVOIR_TWO_STATE; } return state; } /*********************************************************************//** * @brief - * The handleDePrimeDrainReservoirTwoState function sends command to DG to drain + * The handleDrainReservoirTwoState function sends command to DG to drain * reservoir two. * @details Inputs: none * @details Outputs: drained reservoir two * @return current state (sub-mode) *************************************************************************/ -static DE_PRIME_STATE_T handleDePrimeDrainReservoirTwoState( void ) +static DRAIN_STATE_T handleDrainReservoirTwoState( void ) { - DE_PRIME_STATE_T state = DE_PRIME_DRAIN_RESERVOIR_TWO_STATE; + DRAIN_STATE_T state = DRAIN_RESERVOIR_TWO_STATE; if ( ( DG_MODE_CIRC == getDGOpMode() ) && ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == getDGSubMode() ) ) { @@ -463,7 +462,7 @@ if ( ( TRUE == isDrainStarted ) && ( DG_MODE_CIRC == getDGOpMode() ) ) { isDrainStarted = FALSE; - state = DE_PRIME_COMPLETE_STATE; + state = DRAIN_COMPLETE_STATE; } return state;