Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -r419f50d4fa102303441fab187512f0f7cb54bd05 -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision 419f50d4fa102303441fab187512f0f7cb54bd05) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2021-2024 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 Rinseback.c * * @author (last) Sean Nash -* @date (last) 17-Jul-2023 +* @date (last) 08-Sep-2023 * * @author (original) Sean Nash * @date (original) 20-Jan-2021 @@ -68,6 +68,7 @@ static F32 totalAdditionalRinsebackVolume_mL; ///< Total accumulated volume (in mL) delivered so far for all additional volumes combined. static U32 rinsebackAdditionalTimerCtr; ///< Timer counter for duration of an additional rinseback delivery. static U32 rinsebackPublishTimerCtr; ///< Timer counter for determining interval for rinseback status to be published. + /// Interval (in task intervals) at which to publish rinseback data to CAN bus. static OVERRIDE_U32_T rinsebackPublishInterval = { RINSEBACK_DATA_PUBLISH_INTERVAL, RINSEBACK_DATA_PUBLISH_INTERVAL, RINSEBACK_DATA_PUBLISH_INTERVAL, 0 }; @@ -282,12 +283,6 @@ rinsebackTimerCtr++; - // Check for user confirmation of end treatment - if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == getConfirmationRequestStatus( GENERIC_CONFIRM_ID_TREATMENT_END ) ) - { - endTreatmentRequested = TRUE; - } - switch ( rinsebackState ) { case RINSEBACK_STOP_INIT_STATE: @@ -465,8 +460,9 @@ * @brief * The handleRinsebackPausedState function handles the rinseback paused * state operations. - * @details Inputs: flags - * @details Outputs: flags handled + * @details Inputs: rinsebackTimerCtr, resumeRinsebackRequested, + * endTreatmentRequested, endRinsebackRequested, rinsebackRate_mL_min + * @details Outputs: targetRinsebackVolumePlusAdditional_mL * @return next rinseback state *************************************************************************/ static RINSEBACK_STATE_T handleRinsebackPausedState( void ) @@ -484,6 +480,10 @@ setupForRinsebackDelivery( rinsebackRate_mL_min ); result = RINSEBACK_RUN_STATE; } + else if ( TRUE == endTreatmentRequested ) + { + signalEndTreatment(); + } // Has user requested to end rinseback? else if ( TRUE == endRinsebackRequested ) { @@ -865,15 +865,8 @@ if ( RINSEBACK_PAUSED_STATE == rinsebackState ) { - if ( getNoRetriggerFlag() != TRUE ) - { - result = TRUE; - resumeRinsebackRequested = TRUE; - } - else - { - *rejReason = REQUEST_REJECT_REASON_TREATMENT_CANNOT_BE_RESUMED; - } + result = TRUE; + resumeRinsebackRequested = TRUE; } else if ( RINSEBACK_RECONNECT_PATIENT_STATE == rinsebackState ) { @@ -1052,19 +1045,26 @@ data.targetRinsebackVolumeMl = rinsebackTargetVolume_mL; rinsebackPublishTimerCtr = 0; // If we have completed rinseback, timeout is no longer in force - indicate by zeroing timeout. Also include any additionals to target. + data.timeout = 0; + data.countdown = 0; if ( ( rinsebackState > RINSEBACK_PAUSED_STATE ) && ( getRinsebackVolume() >= rinsebackTargetVolume_mL ) ) { data.targetRinsebackVolumeMl = targetRinsebackVolumePlusAdditional_mL; - timeout = 0; } data.deliveredRinsebackVolumeMl = getRinsebackVolume(); data.rinsebackFlowRateMlMin = rinsebackRate_mL_min; if ( RINSEBACK_RUN_ADDITIONAL_STATE == rinsebackState ) { data.rinsebackFlowRateMlMin = DEFAULT_RINSEBACK_FLOW_RATE_ML_MIN; } - data.timeout = timeout; - data.countdown = countdown; + if ( getRinsebackCompleted() != TRUE ) + { + if ( rinsebackTimerCtr > 0 ) // Timer set to zero when BP is running + { + data.timeout = timeout; + data.countdown = countdown; + } + } if ( data.deliveredRinsebackVolumeMl >= rinsebackTargetVolume_mL ) { data.isCompleted = TRUE;