Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -re23087e0c17f6ea81d60641fdb52121a8dd5a099 -r1afd5c87ef15399998a743c2ebcafe2cc03bd363 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision e23087e0c17f6ea81d60641fdb52121a8dd5a099) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 1afd5c87ef15399998a743c2ebcafe2cc03bd363) @@ -743,7 +743,7 @@ U32 dialVolume = presDialysateFlowRate * treatmentTime; // In mL // Always adjust UF volume to accommodate treatment time change (not UF rate) - uFVolume = ( (F32)( treatmentTime - CALC_ELAPSED_TREAT_TIME_IN_MIN() ) * presUFRate ) + getUltrafiltrationVolumeCollected(); + uFVolume = ( (F32)( treatmentTime - CALC_ELAPSED_TREAT_TIME_IN_MIN() ) * presUFRate ) + getUltrafiltrationReferenceVolume(); if ( ( treatmentTime <= MAX_TREATMENT_TIME_MINUTES ) && ( dialVolume <= MAX_DIALYSATE_VOLUME_ML ) && ( uFVolume <= MAX_UF_VOLUME_ML ) ) @@ -1181,12 +1181,12 @@ U32 elapseTime = CALC_ELAPSED_TREAT_TIME_IN_MIN(); U32 minTime = MAX( (elapseTime + 2), MIN_TREATMENT_TIME_MINUTES ); // Treatment duration cannot be < 1 hour. add two minutes to cover rounding and ensure it is valid for next minute // Compute maximum treatment duration (from both UF and dialysate volume perspectives) - U32 maxTimeRem = ( MAX_UF_VOLUME_ML - (U32)getUltrafiltrationVolumeCollected() ) / ( presUFRate > 0.0 ? (U32)presUFRate : 1 ); + U32 maxTimeRem = ( MAX_UF_VOLUME_ML - (U32)getUltrafiltrationReferenceVolume() ) / ( presUFRate > 0.0 ? (U32)presUFRate : 1 ); U32 maxTime1 = minTime + maxTimeRem; U32 maxTime2 = MAX_DIALYSATE_VOLUME_ML / presDialysateFlowRate; U32 maxTime = MAX( maxTime1, maxTime2 ); // Compute minimum UF volume - F32 minUFVol = getUltrafiltrationVolumeCollected() + presUFRate; + F32 minUFVol = getUltrafiltrationReferenceVolume() + presUFRate; // Compute maximum UF volume (considering from adjustment of UF rate and time perspectives) F32 maxUFVol1 = minUFVol + ( (F32)( presTime - elapseTime ) * MAX_UF_RATE_ML_MIN ); F32 maxUFVol2 = ( presUFRate > 0.0 ? minUFVol + ( (F32)( MAX_TREATMENT_TIME_MINUTES - elapseTime - 1 ) * presUFRate ) : minUFVol );