Index: firmware/App/Services/Reservoirs.h =================================================================== diff -u -rebbb1f85550a1f9b8f946655f7b2b63f76fbf67d -r94a190522ce398399c7b93c59f788d7666ec0060 --- firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision ebbb1f85550a1f9b8f946655f7b2b63f76fbf67d) +++ firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision 94a190522ce398399c7b93c59f788d7666ec0060) @@ -1,36 +1,39 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file Reservoirs.h +* @file Reservoirs.h * -* @author (last) Quang Nguyen -* @date (last) 25-Aug-2020 +* @author (last) Dara Navaei +* @date (last) 01-Nov-2021 * -* @author (original) Sean -* @date (original) 18-Mar-2020 +* @author (original) Sean +* @date (original) 18-Mar-2020 * ***************************************************************************/ - -#ifndef __RESERVOIRS_H__ -#define __RESERVOIRS_H__ +#ifndef __RESERVOIRS_H__ +#define __RESERVOIRS_H__ + #include "DGCommon.h" -#include "DGDefs.h" - -/** - * @defgroup Reservoirs Reservoirs - * @brief Reservoirs service module. Maintains reservoir set points and handles reservoir related commands from the HD. - * - * @addtogroup Reservoirs - * @{ - */ - -// ********** public definitions ********** +#include "DGDefs.h" +#include "NVDataMgmt.h" +/** + * @defgroup Reservoirs Reservoirs + * @brief Reservoirs service module. Maintains reservoir set points and handles reservoir related commands from the HD. + * + * @addtogroup Reservoirs + * @{ + */ + +// ********** public definitions ********** + +#define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. + #pragma pack(push,1) /// Fill command data structure. @@ -43,8 +46,10 @@ /// Drain command data structure. typedef struct { - U32 targetVolume; ///< Target volume to drain to (in mL) - BOOL tareLoadCell; ///< Flag to tare load call + U32 targetVolume; ///< Target volume to drain to (in mL) + BOOL tareLoadCell; ///< Flag to tare load call + BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines or not + U32 cmd; ///< General command (start/stop) } DRAIN_CMD_T; /// DG command response data record. @@ -68,8 +73,10 @@ // ********** public function prototypes ********** void initReservoirs( void ); -void execReservoirs( void ); +void execReservoirs( void ); +SELF_TEST_STATUS_T execReservoirsSelfTest( void ); + void setActiveReservoirCmd( DG_RESERVOIR_ID_T resID ); // handle switch reservoirs command from HD void changeValveSettingCmd( DG_VALVE_SETTING_ID_T valveSettingID ); // handle valve setting change command from HD void startFillCmd( U32 fillToVolMl ); // handle fill command from HD @@ -78,14 +85,17 @@ void stopDrainCmd( void ); // handle stop drain command from HD void tareReservoir( void ); - void resetReservoirsLowestWeight( void ); - + DG_RESERVOIR_ID_T getInactiveReservoir( void ); F32 getReservoirWeight( DG_RESERVOIR_ID_T reservoirId ); + +DG_RESERVOIR_VOLUME_RECORD_T getReservoirsCalRecord( void ); BOOL hasTargetFillVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId ); -BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId , U32 timeout ); +BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId, U32 timeout ); +void tareLoadCellsAtEmpty( DG_RESERVOIR_ID_T reservoirId ); +BOOL isReservoirTarePending( void ); BOOL testSetDGActiveReservoirOverride( DG_RESERVOIR_ID_T value ); BOOL testResetDGActiveReservoirOverride( void );