Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -ra2c32d4d221603054ca9ad7a097112caebf08c4e -r476da1c222d2af6833d9e66a637c977bf927188f --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision a2c32d4d221603054ca9ad7a097112caebf08c4e) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 476da1c222d2af6833d9e66a637c977bf927188f) @@ -91,6 +91,10 @@ setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); +#ifndef V_2_SYSTEM + setValveStateDelayed( VRD1, VALVE_STATE_CLOSED, 0 ); + setValveStateDelayed( VRD2, VALVE_STATE_CLOSED, 0 ); +#endif signalDrainPumpHardStop(); requestConcentratePumpsOff( CONCENTRATEPUMPS_CP1_ACID ); Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r99b0c8f1ff9f9319f68e5043cd8c007e317a05c0 -r476da1c222d2af6833d9e66a637c977bf927188f --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 99b0c8f1ff9f9319f68e5043cd8c007e317a05c0) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 476da1c222d2af6833d9e66a637c977bf927188f) @@ -131,9 +131,7 @@ activeReservoir.data = (U32)resID; cmdResponse.rejected = FALSE; setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); -#ifndef V_2_SYSTEM - setValveState( VRD1, VALVE_STATE_OPEN ); -#else +#ifdef V_2_SYSTEM setValveState( VRD, VALVE_STATE_R2_C_TO_NO ); #endif setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); @@ -144,9 +142,7 @@ activeReservoir.data = (U32)resID; cmdResponse.rejected = FALSE; setValveState( VRF, VALVE_STATE_R1_C_TO_NC ); -#ifndef V_2_SYSTEM - setValveState( VRD2, VALVE_STATE_OPEN ); -#else +#ifdef V_2_SYSTEM setValveState( VRD, VALVE_STATE_R1_C_TO_NC ); #endif setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); @@ -446,20 +442,7 @@ { BOOL result = FALSE; - F32 loadcellWeight = 0.0; - - // TODO remove this code once the load cell is repaired - if ( DG_RESERVOIR_1 == reservoirId ) - { - loadcellWeight = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_BACKUP ); - } - else - { - loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); - } - // TODO remove the above code the load cell is repaired - - //F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); U32 const targetDrainVolume = getReservoirDrainVolumeTargetMl(); if ( loadcellWeight < reservoirLowestWeight[ reservoirId ] ) @@ -471,11 +454,20 @@ BOOL const hasTimeOut = didTimeout( reservoirWeightUnchangeStartTime[ reservoirId ], timeout ); BOOL const hasTargetReached = ( targetDrainVolume >= loadcellWeight ); - if ( hasTimeOut || hasTargetReached ) + // If the goal is to tare the load cell, then the target drain should be reached and timing out on the + // reservoir weight is not enough + if ( ( TRUE == hasTimeOut ) || ( ( TRUE == hasTargetReached ) && ( FALSE == tareLoadCellRequest ) ) ) { result = TRUE; // Reset for next drain reservoirLowestWeight[ reservoirId ] = MAX_RESERVOIR_WEIGHT; + + if ( TRUE == tareLoadCellRequest ) + { + tareLoadCellRequest = FALSE; + tareLoadCell( associatedLoadCell[ reservoirId ] ); + tareLoadCell( redundantLoadCell[ reservoirId ] ); + } } return result;