Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r12ae81f766052993995d323456fa4c746cf4ee75 -r47a7da55aea88cd7a2b06870226122d0cc8be540 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 12ae81f766052993995d323456fa4c746cf4ee75) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 47a7da55aea88cd7a2b06870226122d0cc8be540) @@ -708,19 +708,17 @@ U32 maxTime2 = MAX_DIALYSATE_VOLUME_ML / presDialysateFlowRate; U32 maxTime = MIN( maxTime1, maxTime2 ); // compute minimum UF volume - U32 minUFVol = (U32)(getUltrafiltrationVolumeCollected()); - // compute maximum UF volume (considering from adjustment of treatment duration or UF rate perspectives) - U32 maxUFVol1 = minUFVol + ( ( CALC_TREAT_TIME_REMAINING_IN_SECS() / SEC_PER_MIN ) * MAX_UF_RATE_ML_MIN ); - U32 maxUFVol2 = ( presUFRate > 0 ? minUFVol + (U32)( ( MAX_TREATMENT_TIME_MINUTES - CALC_ELAPSED_TREAT_TIME_IN_MIN() - 1 ) * presUFRate ) : MAX_UF_VOLUME_ML ); - U32 maxUFVol = MIN( maxUFVol1, maxUFVol2 ); + F32 minUFVol = getUltrafiltrationVolumeCollected() + presUFRate; + // compute maximum UF volume (considering from adjustment of UF rate perspective) + F32 maxUFVol = ( presUFRate > 0.0 ? minUFVol + ( (F32)( MAX_TREATMENT_TIME_MINUTES - CALC_ELAPSED_TREAT_TIME_IN_MIN() - 1 ) * presUFRate ) : (F32)MAX_UF_VOLUME_ML ); // compute minimum dialysate flow rate U32 minDialRate = MIN_DIAL_IN_FLOW_RATE; // compute maximum dialysate flow rate from max dialysate volume perspective U32 maxDialRate = MAX_DIALYSATE_VOLUME_ML / ( presTreatmentTimeSecs / SEC_PER_MIN ); // now ensure maximums do not exceed the literal maximums maxTime = MIN( maxTime, MAX_TREATMENT_TIME_MINUTES ); - maxUFVol = MIN( maxUFVol, MAX_UF_VOLUME_ML ); + maxUFVol = MIN( maxUFVol, (F32)MAX_UF_VOLUME_ML ); maxDialRate = MIN( maxDialRate, MAX_DIAL_IN_FLOW_RATE ); // send updated treatment parameter ranges to UI sendTreatmentParamsRangesToUI( minTime, maxTime, minUFVol, maxUFVol, minDialRate, maxDialRate );