Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r25466a692dfcc7c43413940268f69583614513c3 -r8ceb25eb60c36ccd2d6ff305cb389c5128d6317a --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 25466a692dfcc7c43413940268f69583614513c3) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 8ceb25eb60c36ccd2d6ff305cb389c5128d6317a) @@ -155,8 +155,9 @@ ratios.bicarbMixingRatio = 0.0F; ratios.timeFillPrepMS = 0; - // set the previous target fill volume array - memset( prevTargetFillVolumeML, 0x0, NUM_OF_DG_RESERVOIRS ); + // Initialize the previous reservoir fill volume + prevTargetFillVolumeML[ DG_RESERVOIR_1 ] = FILL_RESERVOIR_TO_VOLUME_ML; + prevTargetFillVolumeML[ DG_RESERVOIR_2 ] = FILL_RESERVOIR_TO_VOLUME_ML; } /*********************************************************************//** @@ -528,12 +529,12 @@ // Get the ultra-filtration volume milliliters // Get the dilution level in percent = spent ultra-filtration volume / target fill volume in milliliters volSpentUFML = getReservoirUltrafiltrationVol( activeReservoir ); - dilutionLevelPct = volSpentUFML / (F32)getTargetFillVolumeBasedOnDialysateFlowML(); + dilutionLevelPct = volSpentUFML / (F32)prevTargetFillVolumeML[ getDGActiveReservoir() ]; // Check if the dilution level has exceeded the limit or the spent volume is more than the amount of volume in the reservoir // If it has, trigger the fill command. This if should not happen and the predictive dilution level should trigger just in time // in advance - if ( ( dilutionLevelPct >= MAX_RESERVOIR_DILUTION ) || ( volSpentML >= (F32)getTargetFillVolumeBasedOnDialysateFlowML() ) ) + if ( ( dilutionLevelPct >= MAX_RESERVOIR_DILUTION ) || ( volSpentML >= (F32)prevTargetFillVolumeML[ getDGActiveReservoir() ] ) ) { if ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == dgSubMode ) {