Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -ra1b8dbb69c4bd2f0cc22e62bede7015c9307d378 -rebbb1f85550a1f9b8f946655f7b2b63f76fbf67d --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision a1b8dbb69c4bd2f0cc22e62bede7015c9307d378) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision ebbb1f85550a1f9b8f946655f7b2b63f76fbf67d) @@ -38,7 +38,7 @@ #define DEFAULT_FILL_VOLUME_ML 1700 ///< Default fill volume for treatment in mL. #define DISINFECT_FILL_VOLUME_ML 2400 ///< Fill volume for disinfection in mL. #define MAX_FILL_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum fill volume in mL. -#define DEFAULT_DRAIN_VOLUME_ML 100 ///< Default drain volume in mL. +#define DEFAULT_DRAIN_VOLUME_ML 0 ///< Default drain volume in mL. #define MAX_DRAIN_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///< Maximum drain volume in mL. #define MAX_RESERVOIR_WEIGHT 10000 ///< Maximum reservoir weight in grams. @@ -79,7 +79,6 @@ void initReservoirs( void ) { activeReservoir.data = (U32)DG_RESERVOIR_1; - fillVolumeTargetMl.data = DEFAULT_FILL_VOLUME_ML; drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; } @@ -344,10 +343,36 @@ } sendCommandResponseMsg( &cmdResponse ); -} +} /*********************************************************************//** * @brief + * The tareReservoir function sets the tare load cell variable to TRUE. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void tareReservoir( void ) +{ + tareLoadCellRequest = TRUE; +} + +/*********************************************************************//** + * @brief + * The resetReservoirsLowestWeight function resets the lowest load cell + * weight of the reservoirs. + * @details Inputs: reservoirLowestWeight + * @details Outputs: reservoirLowestWeight + * @return none + *************************************************************************/ +void resetReservoirsLowestWeight( void ) +{ + reservoirLowestWeight[ DG_RESERVOIR_1 ] = MAX_RESERVOIR_WEIGHT; + reservoirLowestWeight[ DG_RESERVOIR_2 ] = MAX_RESERVOIR_WEIGHT; +} + +/*********************************************************************//** + * @brief * The getInactiveReservoir function gets the inactive reservoir. * @details Inputs: activeReservoir * @details Outputs: none @@ -410,7 +435,21 @@ BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId, U32 timeout ) { BOOL result = FALSE; - F32 const loadcellWeight = getLoadCellSmallFilteredWeight( associatedLoadCell[ reservoirId ] ); + + 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 ] ); U32 const targetDrainVolume = getReservoirDrainVolumeTargetMl(); if ( loadcellWeight < reservoirLowestWeight[ reservoirId ] ) @@ -440,21 +479,6 @@ /*********************************************************************//** * @brief - * The resetReservoirLoadCellsOffset function sets the reservoir's load cells - * offset to zero. - * @details Inputs: associateLoadCell[], redundantLoadCell[] - * @details Outputs: reset reservoir's associate load cells auto calibration offset - * @param reservoirId reservoir id - * @return none - *************************************************************************/ -void resetReservoirLoadCellsOffset( DG_RESERVOIR_ID_T reservoirId ) -{ - resetLoadCellOffset( associatedLoadCell[ reservoirId ] ); - resetLoadCellOffset( redundantLoadCell[ reservoirId ] ); -} - -/*********************************************************************//** - * @brief * The getActiveReservoir function gets the active reservoir. * @details Inputs: activeReservoir * @details Outputs: none