Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r5f1388ca0f6672b9ab90eef649de8dc921c9beb2 -r2252531a88ffae920ef57f42e29badbd0d6a5491 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 5f1388ca0f6672b9ab90eef649de8dc921c9beb2) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 2252531a88ffae920ef57f42e29badbd0d6a5491) @@ -7,8 +7,8 @@ * * @file ModeFill.c * -* @author (last) James Walter Taylor -* @date (last) 13-Sep-2023 +* @author (last) Dara Navaei +* @date (last) 19-Sep-2023 * * @author (original) Leonardo Baloa * @date (original) 19-Nov-2019 @@ -207,6 +207,8 @@ concPumpPrimeStartTimeMS = getMSTimerCount(); conductivitySampleCount = 0; dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; + // This timer is set to 0 to be checked whether we were in pause but this is still 0 so so we the start time regardless + // If we were filling and then went to pause we do not reset this anymore dialysateFillStartTimeMS = 0; dialysatePauseElapsedTimeMS = 0; dialysatePauseStartTimeMS = 0; @@ -895,7 +897,7 @@ // Check if run out of time to fill the reservoir, disregarding time paused, // because pause time isn't the reservoir's, or loadcell's fault // the 5 minutes DIALYSATE_FILL_TIME_OUT is a mystery number. - if ( TRUE == didTimeout( dialysateFillStartTimeMS, DIALYSATE_FILL_TIME_OUT+dialysatePauseElapsedTimeMS ) ) + if ( TRUE == didTimeout( dialysateFillStartTimeMS, DIALYSATE_FILL_TIME_OUT + dialysatePauseElapsedTimeMS ) ) { activateAlarmNoData( ALARM_ID_DG_DIALYSATE_FILL_OUT_OF_TIME ); } @@ -1014,9 +1016,9 @@ // Execute cleanup on exiting pause if ( state != fillState ) { - if (DG_FILL_MODE_STATE_PAUSED == fillState) + if ( DG_FILL_MODE_STATE_PAUSED == fillState ) { // accumulate pause - dialysatePauseElapsedTimeMS += calcTimeSince(dialysatePauseStartTimeMS); + dialysatePauseElapsedTimeMS += calcTimeSince( dialysatePauseStartTimeMS ); } } @@ -1089,7 +1091,7 @@ case DG_FILL_MODE_STATE_DELIVER_DIALYSATE: setValveState( VPO, VALVE_STATE_FILL_C_TO_NC ); - if ( didFillRecoverFromPause != TRUE ) + if ( ( didFillRecoverFromPause != TRUE ) || ( 0 == dialysateFillStartTimeMS ) ) { dialysateFillStartTimeMS = getMSTimerCount(); }