Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r99b0c8f1ff9f9319f68e5043cd8c007e317a05c0 -r1a5efe97f5f39594b45797fded52cafce92afe80 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 99b0c8f1ff9f9319f68e5043cd8c007e317a05c0) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 1a5efe97f5f39594b45797fded52cafce92afe80) @@ -446,20 +446,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 +458,18 @@ BOOL const hasTimeOut = didTimeout( reservoirWeightUnchangeStartTime[ reservoirId ], timeout ); BOOL const hasTargetReached = ( targetDrainVolume >= loadcellWeight ); - if ( hasTimeOut || hasTargetReached ) + 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;