Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 -r085476747d1b466802f94f5926fc53a8ec463ec5 --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 085476747d1b466802f94f5926fc53a8ec463ec5) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TreatmentEnd.c * * @author (last) Sean Nash -* @date (last) 19-Aug-2021 +* @date (last) 12-Nov-2021 * * @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 ); + } } }