Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r6811f0251b0fa7d27c3e6d5eb16ade2bc88a3204 -r32f48aca25ae69089c2cf77936239cce6daac229 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 6811f0251b0fa7d27c3e6d5eb16ade2bc88a3204) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 32f48aca25ae69089c2cf77936239cce6daac229) @@ -56,10 +56,10 @@ // DG status 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 U32 dgSubMode = 0; ///< Current state (sub-mode) of current DG operation mode. +static BOOL dgStartCommandSent = FALSE; ///< Flag indicates command to start DG has been sent. static BOOL dgStarted = FALSE; ///< Flag indicates whether we have commanded the DG to start or stop. static BOOL dgTrimmerHeaterOn = FALSE; ///< Flag indicates whether we have commanded the DG to start or stop the trimmer heater. -static BOOL dgWaterSampled = FALSE; ///< Flag indicates whether we have commanded the DG to sample water. // State machine states /// Current state of treatment mode reservoir management. @@ -120,7 +120,6 @@ dgStarted = FALSE; dgTrimmerHeaterOn = FALSE; - dgWaterSampled = FALSE; dgPrimaryTempSet = 0.0; dgTrimmerTempSet = 0.0; dgActiveReservoirSet = DG_RESERVOIR_2; @@ -693,7 +692,7 @@ *************************************************************************/ void cmdStartDG( void ) { - dgStarted = TRUE; + dgStartCommandSent = TRUE; sendDGStartStopCommand( START_DG_CMD ); } @@ -798,8 +797,22 @@ { dgCmdResp[ DG_CMD_START_FILL ].commandID = DG_CMD_NONE; dgReservoirFillVolumeTargetSet = fillToVolMl; - sendDGFillCommand( fillToVolMl ); + sendDGFillCommand( DG_CMD_START, fillToVolMl ); } + +/*********************************************************************//** + * @brief + * The cmdStopDGFill function sends a fill command with stop parameter message to the DG. + * @details Inputs: none + * @details Outputs: fill command with stop parameter sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGFill( void ) +{ + dgCmdResp[ DG_CMD_STOP_FILL ].commandID = DG_CMD_NONE; + dgReservoirFillVolumeTargetSet = 0; + sendDGFillCommand( DG_CMD_STOP, 0 ); +} /*********************************************************************//** * @brief @@ -828,10 +841,9 @@ * @details Outputs: sample water command sent to DG. * @return none *************************************************************************/ -void cmdDGSampleWater( void ) +void cmdDGSampleWater( SAMPLE_WATER_CMD_T cmd ) { - dgWaterSampled = TRUE; - sendDGSampleWaterCommand(); + sendDGSampleWaterCommand( cmd ); } /*********************************************************************//** @@ -897,7 +909,33 @@ return hasCommandResp; } +/*********************************************************************//** + * @brief + * The checkDGRestart function checks to see if DG has restarted after started + * by HD and triggers appropriate alarm. + * @details Inputs: dgStarted + * @details Outputs: triggers a fault alarm if DG restarted + * @return none + *************************************************************************/ +void checkDGRestart( void ) +{ + if ( ( dgStartCommandSent == TRUE ) && ( DG_MODE_CIRC == dgCurrentOpMode ) ) + { + dgStartCommandSent = FALSE; + dgStarted = TRUE; + } + if ( TRUE == dgStarted ) + { + if ( ( DG_MODE_FAUL != dgCurrentOpMode ) && ( DG_MODE_CIRC != dgCurrentOpMode ) && + ( DG_MODE_FILL != dgCurrentOpMode ) && ( DG_MODE_DRAI != dgCurrentOpMode ) ) + { + activateAlarmNoData( ALARM_ID_DG_RESTARTED_FAULT ); + } + } +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/