Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r9c523a8628bb75b601c048f67d3ef7250f45f547 -r012ee7b4f72e47aa351eb723abca0e3104ea677b --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 9c523a8628bb75b601c048f67d3ef7250f45f547) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 012ee7b4f72e47aa351eb723abca0e3104ea677b) @@ -45,8 +45,10 @@ #define MIN_DRAIN_INLET_PSI_EMPTY -3.0 ///< Minimum drain inlet pressure (in PSI) to indicate reservoir is empty while drain pump on. -#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. +#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. +#define MAX_REDUNDANT_LOAD_CELL_DIFF 50.0 ///< Maximum difference in redundant load cells when determing if fill completed. + // ********** private data ********** static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. @@ -461,10 +463,17 @@ *************************************************************************/ BOOL hasTargetFillVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId ) { - F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + F32 const loadcellWeight1 = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + F32 const loadcellWeight2 = getLoadCellSmallFilteredWeight( redundantLoadCell[ reservoirId ] ); U32 const targetFillVolume = getU32OverrideValue( &fillVolumeTargetMl ); - BOOL const hasTargetReached = ( loadcellWeight >= targetFillVolume ); + BOOL const hasTargetReached = ( ( loadcellWeight1 >= targetFillVolume || loadcellWeight2 > ( targetFillVolume + MAX_REDUNDANT_LOAD_CELL_DIFF ) ) ? TRUE : FALSE ); + // if redundant load cells too far apart at end of fill, alarm + if ( loadcellWeight1 < targetFillVolume ) + { + // TODO - alarm + } + return hasTargetReached; }