Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -rdb291cc22fd8f10e6e47cad468e14ed5590a94f2 -r5dc15621f83c8fe19da6b82b4492102d699a8a14 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision db291cc22fd8f10e6e47cad468e14ed5590a94f2) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 5dc15621f83c8fe19da6b82b4492102d699a8a14) @@ -45,6 +45,8 @@ #define PRES_LIMIT_STABILIZATION_TIME_MS ( 60 * MS_PER_SECOND ) ///< Duration of pressure limit stabilization period (in ms). #define PRES_LIMIT_SHORT_STABILIZE_TIME_MS ( 10 * MS_PER_SECOND ) ///< Duration of pressure limit short stabilization period (in ms). #define PRES_LIMIT_RESTABILIZE_TIME_MS ( 30 * SEC_PER_MIN * MS_PER_SECOND ) ///< Duration of pressure limit re-stabilize period (in ms). +// Pressure Limit minimum stabilization time before short stabilization time activation +static const U32 PRES_LIMIT_MIN_STABILIZATION_TIME_IN_MS = ( PRES_LIMIT_STABILIZATION_TIME_MS - PRES_LIMIT_SHORT_STABILIZE_TIME_MS ) ; #define ARTERIAL_PRESSURE_CONVERSION_OFFSET 0x800000 ///< Arterial pressure conversion coefficient. #define ARTERIAL_PRESSURE_V_BIAS ( 3.0F ) ///< Bias voltage for arterial pressure sensor. @@ -450,15 +452,24 @@ *************************************************************************/ void signalInitiatePressureStabilization( BOOL useShort ) { - useShortStabilizeTime = useShort; - // User update of blood/dialysate flow rate or UF rate or initiates/resets a stabilization period (if we were in stabilization or stable state) if ( PRESSURE_LIMITS_STATE_STABILIZATION == currPresLimitsState ) { - stabilizationStartTimeMs = getMSTimerCount(); + U32 currentTime = getMSTimerCount(); + U32 expiredTime = u32DiffWithWrap( stabilizationStartTimeMs , currentTime ); + + // if pressure is already stabilized enough, assign the short stabilize time for the recent event ( air pump on). + // else,leave the current/on going stabilization to expire due to long pending stable time to settle down the pressure. + // allow Normal stabilization on a case when user updates flow rate or UF rate etc., + if ( expiredTime > PRES_LIMIT_MIN_STABILIZATION_TIME_IN_MS || useShort == FALSE ) + { + useShortStabilizeTime = useShort; + stabilizationStartTimeMs = getMSTimerCount(); + } } else if ( PRESSURE_LIMITS_STATE_STABLE == currPresLimitsState ) { + useShortStabilizeTime = useShort; currPresLimitsState = PRESSURE_LIMITS_STATE_STABILIZATION; stabilizationStartTimeMs = getMSTimerCount(); }