Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rfee22801cab60be10f4e7c08a1a96645dfdcaf8b -r1017bbc5760a50e20357da1e4f705b3e6157375e --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision fee22801cab60be10f4e7c08a1a96645dfdcaf8b) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 1017bbc5760a50e20357da1e4f705b3e6157375e) @@ -27,11 +27,11 @@ // ********** private definitions ********** -#define START_DG_CMD TRUE ///< Parameter for DG start/stop command function. True = start. -#define STOP_DG_CMD FALSE ///< Parameter for DG start/stop command function. False = stop. +#define START_DG_CMD TRUE ///< Parameter for DG start/stop command function. True = start. +#define STOP_DG_CMD FALSE ///< Parameter for DG start/stop command function. False = stop. -#define DRAIN_RESERVOIR_TO_VOLUME_ML 100 ///< Drain reservoir to this volume (in mL) during treatment. -#define FILL_RESERVOIR_TO_VOLUME_ML 1500 ///< Fill reservoir to this volume (in mL) during treatment. +#define DRAIN_RESERVOIR_TO_VOLUME_ML 100 ///< Drain reservoir to this volume (in mL) during treatment. +#define FILL_RESERVOIR_TO_VOLUME_ML 1500 ///< Fill reservoir to this volume (in mL) during treatment. /// States of the treatment reservoir management state machine. typedef enum TreatmentReservoirMgmt_States @@ -48,35 +48,34 @@ // ********** private data ********** // DG status -static DG_OP_MODE_T dgCurrentOpMode = DG_MODE_INIT; -static U32 dgSubMode = 0; -static BOOL dgStarted = FALSE; -static BOOL dgStartetSet = FALSE; -static BOOL dgWaterSampled = FALSE; -static BOOL dgWaterSampledSet = FALSE; +static DG_OP_MODE_T dgCurrentOpMode = DG_MODE_INIT; ///< Current DG operation mode. +static U32 dgSubMode = 0; ///< Current state (sub-mode) of current DG operation mode. +static BOOL dgStarted = FALSE; ///< Flag indicates whether we've commanded the DG to start or stop. +static BOOL dgTrimmerHeaterOn = FALSE; ///< Flag indicates whether we've commanded the DG to start or stop the trimmer heater. +static BOOL dgWaterSampled = FALSE; ///< Flag indicates whether we've commanded the DG to sample water. // state machine states static TREATMENT_RESERVOIR_MGMT_STATE_T currentTrtResMgmtState = TREATMENT_RESERVOIR_MGMT_START_STATE; ///< Current state of treatment mode reservoir management. // DG sensor data -static F32 dgPressures[ NUM_OF_DG_PRESSURE_SENSORS ]; -static F32 dgPrimaryTempSet = 0.0; -static F32 dgPrimaryTemp = 0.0; -static F32 dgTrimmerTempSet = 0.0; -static F32 dgTrimmerTemp = 0.0; +static F32 dgPressures[ NUM_OF_DG_PRESSURE_SENSORS ]; ///< Latest pressures reported by the DG. +static F32 dgPrimaryTempSet = 0.0; ///< Primary heater target temperature commanded. +static F32 dgPrimaryTemp = 0.0; ///< Latest RO water temperature reported by the DG. +static F32 dgTrimmerTempSet = 0.0; ///< Trimmer heater target temperature commanded. +static F32 dgTrimmerTemp = 0.0; ///< Latest dialysate temperature reported by the DG. // DG pumps data -static F32 dgROPumpFlowRateMlMin = 0.0; -static U32 dgROPumpPressureSetPtPSI = 0; -static U32 dgDrainPumpSpeedSetPtRPM = 0; +static F32 dgROPumpFlowRateMlMin = 0.0; ///< Latest RO water flow rate reported by the DG. +static U32 dgROPumpPressureSetPtPSI = 0; ///< Latest RO pump target pressure reported by the DG. +static U32 dgDrainPumpSpeedSetPtRPM = 0; ///< Latest Drain pump target speed reported by the DG. // reservoir data -static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; -static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; -static U32 dgReservoirFillVolumeTarget = 0; -static U32 dgReservoirFillVolumeTargetSet = 0; -static U32 dgReservoirDrainVolumeTarget = 0; -static U32 dgReservoirDrainVolumeTargetSet = 0; +static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. +static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. +static U32 dgReservoirFillVolumeTarget = 0; ///< Latest fill-to volume reported by the DG. +static U32 dgReservoirFillVolumeTargetSet = 0; ///< Fill-to volume commanded. +static U32 dgReservoirDrainVolumeTarget = 0; ///< Latest drain-to volume reported by the DG. +static U32 dgReservoirDrainVolumeTargetSet = 0; ///< Drain-to volume commanded. // ********** private function prototypes ********** @@ -210,6 +209,19 @@ /*********************************************************************//** * @brief + * The getDGActiveReservoir function gets the current active reservoir. + * @details + * Inputs : dgActiveReservoirSet + * Outputs : none + * @return Currently commanded active reservoir. + *************************************************************************/ +DG_RESERVOIR_ID_T getDGActiveReservoir( void ) +{ + return dgActiveReservoirSet; +} + +/*********************************************************************//** + * @brief * The getDGPressure function gets the latest pressure reported by the DG \n * for a given pressure sensor. * @details @@ -439,6 +451,18 @@ sendDGStartStopCommand( STOP_DG_CMD ); } +void cmdStartDGTrimmerHeater( void ) +{ + dgTrimmerHeaterOn = TRUE; + sendDGStartStopTrimmerHeaterCommand( START_DG_CMD ); +} + +void cmdStopDGTrimmerHeater( void ) +{ + dgTrimmerHeaterOn = FALSE; + sendDGStartStopTrimmerHeaterCommand( STOP_DG_CMD ); +} + /*********************************************************************//** * @brief * The cmdSetDGActiveReservoir function sends a set active reservoir command \n