Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -r3d72b777cf1ceb673d118341c46e2d6d5b7b75f5 -r29b362c485f28f45ef367342ac895e1c1907ac45 --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 3d72b777cf1ceb673d118341c46e2d6d5b7b75f5) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 29b362c485f28f45ef367342ac895e1c1907ac45) @@ -7,8 +7,8 @@ * * @file TreatmentEnd.c * -* @author (last) Sean Nash -* @date (last) 12-Nov-2021 +* @author (last) Darren Cox +* @date (last) 06-Apr-2022 * * @author (original) Sean Nash * @date (original) 05-Feb-2021 @@ -39,11 +39,6 @@ /// Max time to wait for user to initiate final rinseback. static const U32 TX_END_TIMEOUT_MS = ( ( 15 * 60 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); // TODO - get time from Systems -/// Maximum time in this mode before blood sitting alarm given (in general task intervals). -static const U32 MAX_TIME_BLOOD_SITTING = ( ( 5 * SEC_PER_MIN * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); -/// Maximum time in this mode before blood sitting warning given (in general task intervals). -static const U32 WARN_TIME_BLOOD_SITTING = ( ( 4 * SEC_PER_MIN * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); - // ********** private data ********** static TREATMENT_END_STATE_T treatmentEndState; ///< Current state of the treatment end sub-mode. @@ -55,6 +50,7 @@ static BOOL txEndAlarmRinsebackRequested; ///< Flag indicates user requesting rinseback from alarm. static BOOL txEndAlarmEndTreatmentRequested; ///< Flag indicates user requesting end treatment from alarm. static BOOL txEndRinsebackRequested; ///< Flag indicates user requesting final rinseback. +static BOOL txEndDrainCmdSent; ///< Flag indicates DG Drain command has been sent. // ********** private function prototypes ********** @@ -81,6 +77,7 @@ treatmentEndState = TREATMENT_END_WAIT_FOR_RINSEBACK_STATE; txEndTimerCtr = 0; bloodSittingTimerCtr = 0; + txEndDrainCmdSent = FALSE; resetTreatmentEndFlags(); } @@ -233,7 +230,11 @@ } else { - cmdStartDGDrain( DRAIN_RESERVOIR_TO_VOLUME_ML, TRUE, FALSE, TRUE ); + if ( txEndDrainCmdSent != TRUE ) + { + txEndDrainCmdSent = TRUE; + cmdStartDGDrain( DRAIN_RESERVOIR_TO_VOLUME_ML, TRUE, FALSE, TRUE ); + } } }