Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r2dd1b02e90c90fcd94bf9b21245282205a963654 -r5fe5ec536e282d82a2539b59c79803b78992f3f8 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 2dd1b02e90c90fcd94bf9b21245282205a963654) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 5fe5ec536e282d82a2539b59c79803b78992f3f8) @@ -1600,6 +1600,9 @@ syringePumpVolumeStartPosition = syringePumpPosition.data; } + // Check for stall + stopPump = checkForStall( stopPump ); + // Has syringe been removed? stopPump = checkSyringeRemoved( stopPump ); @@ -2014,30 +2017,30 @@ BOOL result = stopPump; // Check for stall - if ( fabs( getSyringePumpMeasRate() ) < SYRINGE_PUMP_STALL_SPEED_THRESHOLD ) - { - if ( ++syringePumpStallCtr >= SYRINGE_PUMP_RAMP_STALL_TIME ) - { - if ( ++syringePumpStallRetryCount <= SYRINGE_PUMP_RAMP_STALL_RETRIES ) - { - syringePumpSetToggleTime++; // lower target rate (by increasing time between steps) - syringePumpRampTimerCtr = 0; // restart ramp - syringePumpRampUpToggleTime = SYRINGE_PUMP_START_RAMP_SPEED; - syringePumpStallCtr = 0; // reset stall counter - } - else - { - result = TRUE; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SYRINGE_PUMP_STALL, (U32)getSyringePumpPosition(), (U32)syringePumpState ); - } - } - } - else - { + if ( fabs( getSyringePumpMeasRate() ) < SYRINGE_PUMP_STALL_SPEED_THRESHOLD ) + { + if ( ++syringePumpStallCtr >= SYRINGE_PUMP_RAMP_STALL_TIME ) + { + if ( ++syringePumpStallRetryCount <= SYRINGE_PUMP_RAMP_STALL_RETRIES ) + { + syringePumpSetToggleTime++; // lower target rate (by increasing time between steps) + syringePumpRampTimerCtr = 0; // restart ramp + syringePumpRampUpToggleTime = SYRINGE_PUMP_START_RAMP_SPEED; + syringePumpStallCtr = 0; // reset stall counter + } + else + { + result = TRUE; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SYRINGE_PUMP_STALL, (U32)getSyringePumpPosition(), (U32)syringePumpState ); + } + } + } + else + { syringePumpStallCtr = 0; - } + } - return result; + return result; } /*********************************************************************//** Index: firmware/App/Modes/Prime.c =================================================================== diff -u -r38355442b06187fe5d57deca647b3adf2fa26b89 -r5fe5ec536e282d82a2539b59c79803b78992f3f8 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision 38355442b06187fe5d57deca647b3adf2fa26b89) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision 5fe5ec536e282d82a2539b59c79803b78992f3f8) @@ -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. @@ -918,7 +919,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 ) { @@ -928,9 +929,12 @@ } else { - minimumReservoirVolume = currentReservoirVolume; steadyVolumeCount = 0; } + if ( currentReservoirVolume < minimumReservoirVolume ) + { + minimumReservoirVolume = currentReservoirVolume; + } steadyVolumeSamplingStartTime = getMSTimerCount(); // re-armed the timer for the next 1 second iteration }