Index: firmware/App/Modes/ModeFill.h =================================================================== diff -u -rb64c49fdcf2b6d95e61e63f8e258c4e600935bbd -re3839e10decfadf12a8fb2b9f8c049d8a30e945b --- firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision b64c49fdcf2b6d95e61e63f8e258c4e600935bbd) +++ firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision e3839e10decfadf12a8fb2b9f8c049d8a30e945b) @@ -1,28 +1,98 @@ /************************************************************************** - * - * Copyright (c) 2019-2020 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 FillMode.h - * - * @date 19-Nov-2019 - * @author L. Baloa - * - * @brief Header file for Fill Mode. - * - **************************************************************************/ +* +* Copyright (c) 2019-2024 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 ModeFill.h +* +* @author (last) Dara Navaei +* @date (last) 29-Feb-2024 +* +* @author (original) Leonardo Baloa +* @date (original) 19-Nov-2019 +* +***************************************************************************/ #ifndef __MODE_FILL_H__ -#define __MODE_FILl_H__ +#define __MODE_FILL_H__ #include "DGCommon.h" +#include "DGDefs.h" -// ********** private function prototypes ********** +/** + * @defgroup DGFillMode DGFillMode + * @brief Fill mode module. Manages fill mode functions via a state machine. + * + * @addtogroup DGFillMode + * @{ + */ +// ********** public definitions ********** + +/// Chemical bottles +typedef enum +{ + ACID = 0, ///< Acid. + BICARB, ///< Bicarb. + NUM_OF_CHEMICALS, ///< Number of chemicals. +} CHEMICAL_BOTTLES_T; + +/// DG broadcast dialysate fill data structure. +typedef struct +{ + F32 averageBicarbConductivity; ///< The average bicarb conductivity calculated in one fill. + F32 averageAcidConductivity; ///< The average acid conductivity calculated in one fill. + U32 isThisTheFirstFill; ///< Indicate if this is the first fill. + F32 pctDiffInConductivity; ///< The percent difference between CD1 and CD2. + F32 usedAcidVolumeML; ///< The used acid volume in ML. + F32 usedBicarbVolumeML; ///< The used bicarb volume in ML. + F32 integratedVolumeML; ///< Integrated volume in milliliters. + U32 roOnlyModeStatus; ///< RO only mode status. + U32 badFillSignal; ///< bad fill signal. + U32 badFillState; ///< bad fill substate. +} DG_FILL_MODE_DATA_T; + +// ********** public function prototypes ********** + void initFillMode( void ); // initialize this module -void transitionToFillMode( void ); // prepares for transition to fill mode -void execFillMode( void ); // execute the fill mode state machine (call from OperationModes) +U32 transitionToFillMode( void ); // prepares for transition to fill mode + +U32 execFillMode( void ); // execute the fill mode state machine (call from OperationModes) + +F32 getAvgFillFlowRateLPM( void ); +F32 getAvgFillTemperature( void ); +F32 getLastFillTemperature( void ); + +void setThisFirstFillFlag( BOOL flag ); // indicates bottles need prime when set to TRUE +void resetFillStatusParameters( void ); + +BOOL isThisTheFirstFill( void ); + +F32 getChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ); +void resetChemicalUsedVolumeML( CHEMICAL_BOTTLES_T bottle ); + +void setROMode( BOOL enableROOnlyMode ); +BOOL isROOnlyModeEnabled( void ); + +void setAcidAndBicarbType( U32 acid, U32 bicarb ); + +BOOL testSetUsedAcidVolumeMLOverride( F32 value ); +BOOL testResetUsedAcidVolumeMLOverride( void ); + +BOOL testSetUsedBicarbVolumeMLOverride( F32 value ); +BOOL testResetUsedBicarbVolumeMLOverride( void ); + +BOOL testSetFillModeDataPublishIntervalOverride( U32 value ); +BOOL testResetFillModeDataPublishIntervalOverride( void ); + +BOOL testSetIntegratedVolumeOverride( F32 value ); +BOOL testResetIntegratedVolumeOverride( void ); + +BOOL testSetModeFillForCal( U32 calForCheck ); + +/**@}*/ + #endif