Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r9d7ad180a18e29ba08bf65228d61b6179ddbfcca -r521a0569bf3097e9f7075d9c0e99dca9af3e6410 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 9d7ad180a18e29ba08bf65228d61b6179ddbfcca) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 521a0569bf3097e9f7075d9c0e99dca9af3e6410) @@ -169,7 +169,7 @@ * Dialysis may be resumed later. * @details * Inputs : none - * Outputs : Blood and dialysate pumps stopped. Heparing pump stopped. + * Outputs : Blood and dialysate pumps stopped. Heparin pump stopped. * @return none *************************************************************************/ void stopDialysis( void ) @@ -216,9 +216,11 @@ BOOL pauseUF( void ) { BOOL result = FALSE; + TREATMENT_STATE_T trtState = getTreatmentState(); OP_MODE currMode = getCurrentOperationMode(); - if ( ( MODE_TREA == currMode ) && ( DIALYSIS_UF_STATE == currentDialysisState ) && ( UF_RUNNING_STATE == currentUFState ) ) + if ( ( MODE_TREA == currMode ) && ( TREATMENT_DIALYSIS_STATE == trtState ) && + ( DIALYSIS_UF_STATE == currentDialysisState ) && ( UF_RUNNING_STATE == currentUFState ) ) { // set outlet pump to dialysate rate result = setDialOutPumpTargetRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); @@ -244,8 +246,9 @@ BOOL resumeUF( void ) { BOOL result = FALSE; + OP_MODE currMode = getCurrentOperationMode(); - if ( ( DIALYSIS_UF_STATE == currentDialysisState ) && ( UF_PAUSED_STATE == currentUFState ) ) + if ( ( MODE_TREA == currMode ) && ( DIALYSIS_UF_STATE == currentDialysisState ) && ( UF_PAUSED_STATE == currentUFState ) ) { S32 inletPumpRate = getTargetDialInFlowRate(); Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r9d7ad180a18e29ba08bf65228d61b6179ddbfcca -r521a0569bf3097e9f7075d9c0e99dca9af3e6410 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 9d7ad180a18e29ba08bf65228d61b6179ddbfcca) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 521a0569bf3097e9f7075d9c0e99dca9af3e6410) @@ -40,23 +40,6 @@ #define TREATMENT_TIME_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) // interval (ms/task time) at which the treatment time data is published on the CAN bus -/// Sub-mode states while in treatment mode -typedef enum Treatment_States -{ - TREATMENT_START_STATE = 0, ///< Start treatment, prime blood side with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. - TREATMENT_DIALYSIS_STATE, ///< Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested. - TREATMENT_STOP_STATE, ///< Treatment stopped. All pumps off. Dializer bypassed. - TREATMENT_RINSEBACK_STATE, ///< Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating. - TREATMENT_RINSEBACK_PAUSE_STATE, ///< Rinseback paused. Blood pump off. Dialyzer bypassed. Dialysate recirculating. - TREATMENT_RECIRC_SETUP_STATE, ///< Rinseback complete. Blood pump off. Blood lines closed. User to disconnect and shunt blood lines. - TREATMENT_RECIRC_STATE, ///< Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed. - TREATMENT_RECIRC_PAUSE_STATE, ///< Recirculate paused. Blood pump off. Blood lines closed and shunted. Dialyzer is bypassed. - TREATMENT_RECIRC_STOP_STATE, ///< Recirculate stopped. Blood pump off. Blood lines open. Waiting for patient to unshunt and connect and resume treatment. - TREATMENT_DIALYSIS_END_STATE, ///< Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback. - TREATMENT_END_STATE, ///< Treatment has ended. All pumps off. Dialyzer is bypassed. Blood lines are closed. User to disconnect. - NUM_OF_TREATMENT_STATES ///< # of treatment states (sub-modes). -} TREATMENT_STATE_T; - // ********** private data ********** static TREATMENT_STATE_T currentTreatmentState; @@ -131,6 +114,19 @@ /************************************************************************* * @brief + * The getTreatmentState function gets the current treatment mode state. + * @details + * Inputs : currentTreatmentState + * Outputs : none + * @return currentTreatmentState + *************************************************************************/ +TREATMENT_STATE_T getTreatmentState( void ) +{ + return currentTreatmentState; +} + +/************************************************************************* + * @brief * The execTreatmentMode function executes the Treatment Mode state machine. * @details * Inputs : none Index: firmware/App/Modes/ModeTreatment.h =================================================================== diff -u -ra7104162b3467a67c5f4ed2f0f2ec038a8738d33 -r521a0569bf3097e9f7075d9c0e99dca9af3e6410 --- firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision a7104162b3467a67c5f4ed2f0f2ec038a8738d33) +++ firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision 521a0569bf3097e9f7075d9c0e99dca9af3e6410) @@ -22,12 +22,31 @@ // ********** public definitions ********** +/// Sub-mode states while in treatment mode +typedef enum Treatment_States +{ + TREATMENT_START_STATE = 0, ///< Start treatment, prime blood side with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. + TREATMENT_DIALYSIS_STATE, ///< Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested. + TREATMENT_STOP_STATE, ///< Treatment stopped. All pumps off. Dializer bypassed. + TREATMENT_RINSEBACK_STATE, ///< Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating. + TREATMENT_RINSEBACK_PAUSE_STATE, ///< Rinseback paused. Blood pump off. Dialyzer bypassed. Dialysate recirculating. + TREATMENT_RECIRC_SETUP_STATE, ///< Rinseback complete. Blood pump off. Blood lines closed. User to disconnect and shunt blood lines. + TREATMENT_RECIRC_STATE, ///< Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed. + TREATMENT_RECIRC_PAUSE_STATE, ///< Recirculate paused. Blood pump off. Blood lines closed and shunted. Dialyzer is bypassed. + TREATMENT_RECIRC_STOP_STATE, ///< Recirculate stopped. Blood pump off. Blood lines open. Waiting for patient to unshunt and connect and resume treatment. + TREATMENT_DIALYSIS_END_STATE, ///< Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback. + TREATMENT_END_STATE, ///< Treatment has ended. All pumps off. Dialyzer is bypassed. Blood lines are closed. User to disconnect. + NUM_OF_TREATMENT_STATES ///< # of treatment states (sub-modes). +} TREATMENT_STATE_T; + // ********** private function prototypes ********** void initTreatmentMode( void ); // initialize this module void transitionToTreatmentMode( void ); // prepares for transition to treatment mode void execTreatmentMode( void ); // execute the treatment mode state machine (call from OperationModes) +TREATMENT_STATE_T getTreatmentState( void ); + BOOL verifyTreatmentDurationSettingChange( U32 treatmentTime ); BOOL verifyUFSettingsChange( F32 uFVolume, UF_ADJ_T adjustment ); BOOL verifyUFSettingsConfirmation( BOOL confirmed, F32 uFVolume, U32 treatmentTime, F32 uFRate );