Index: firmware/App/Modes/Prime.c =================================================================== diff -u -ra6308f42594f03f4ef666cc858fd5432ad7ea63d -ra37189e75de205982befcc91176f33c0523b03a8 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision a6308f42594f03f4ef666cc858fd5432ad7ea63d) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision a37189e75de205982befcc91176f33c0523b03a8) @@ -7,8 +7,8 @@ * * @file Prime.c * -* @author (last) Michael Garthwaite -* @date (last) 16-May-2023 +* @author (last) Sean Nash +* @date (last) 03-Jun-2023 * * @author (original) Quang Nguyen * @date (original) 08-Dec-2020 @@ -62,7 +62,8 @@ #define PRIME_DIALYSATE_BYPASS_TIME_LIMIT ( 8 * MS_PER_SECOND ) ///< Time limit for priming dialysate bypass circuit. #define STEADY_VOLUME_COUNT_SEC ( 10000 / LOAD_CELL_STEADY_VOLUME_SAMPLING_TIME ) ///< Counter must be greater than 10 seconds before steady volume is true. #define STEADY_VOLUME_DIALYSATE_PRIME_TIME_LIMIT_MS ( 55 * MS_PER_SECOND ) ///< Time in msec for the reservoir volume to stabilize during dialysate prime state. -#define STEADY_VOLUME_BYPASS_PRIME_TIME_LIMIT_MS ( 25 * MS_PER_SECOND ) ///< Time in msec for the reservoir volume to stabilize during bypass dialysate prime state. +#define STEADY_VOLUME_BYPASS_PRIME_TIME_LIMIT_MS ( 62 * MS_PER_SECOND ) ///< Time in msec for the reservoir volume to stabilize during bypass dialysate prime state. +#define STEADY_VOLUME_BYPASS_PRIME_HISTERESIS_ML ( 0.3F ) ///< mL of histeresis for the steady state check that determines when bypass line is primed. #define VENOUS_PRESSURE_BUBBLE_CLEAR_MAX_MMHG ( 200.0F ) ///< Maximum venous pressure reading (in mmHg) for bubble clear. #define BUBBLE_CLEAR_WAIT_TIME_INITIAL_MS ( 10 * MS_PER_SECOND ) ///< Time in msec to wait for initial bubble clear pressure. @@ -933,7 +934,7 @@ { F32 const currentReservoirVolume = getLoadCellWeight( LOAD_CELL_RESERVOIR_2_PRIMARY ); - if ( currentReservoirVolume >= minimumReservoirVolume ) + if ( currentReservoirVolume >= ( minimumReservoirVolume - STEADY_VOLUME_BYPASS_PRIME_HISTERESIS_ML ) ) { if ( ++steadyVolumeCount >= STEADY_VOLUME_COUNT_SEC ) { @@ -943,9 +944,12 @@ } else { - minimumReservoirVolume = currentReservoirVolume; steadyVolumeCount = 0; } + if ( currentReservoirVolume < minimumReservoirVolume ) + { + minimumReservoirVolume = currentReservoirVolume; + } steadyVolumeSamplingStartTime = getMSTimerCount(); // re-armed the timer for the next 1 second iteration }