Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -reb5370021e7e60c18732382a512886da0f9b276d -r526e890e4e35fac0a622af538bf611ea15a30609 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision eb5370021e7e60c18732382a512886da0f9b276d) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 526e890e4e35fac0a622af538bf611ea15a30609) @@ -8,7 +8,7 @@ * @file DGInterface.c * * @author (last) Dara Navaei -* @date (last) 07-Apr-2023 +* @date (last) 10-Aug-2023 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -96,8 +96,8 @@ static BOOL dgOpModeDataFreshFlag = FALSE; ///< Flag to signal the handleDGOpMode() to process fresh dg op mode data // Reservoir data -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 DG_RESERVOIR_ID_T dgActiveReservoir; ///< Latest active reservoir reported by the DG. +static DG_RESERVOIR_ID_T dgActiveReservoirSet; ///< Active reservoir commanded. static U32 dgReservoirFillVolumeTarget = 0; ///< Latest fill-to volume reported by the DG. static U32 dgReservoirFillVolumeTargetSet = 0; ///< Fill-to volume commanded. @@ -129,12 +129,13 @@ { U32 i, j; + // NOTE: the active reservoir is set to reservoir 1 since DG will send active reservoir 1 as active on power up dgStarted = FALSE; dgTrimmerHeaterOn = FALSE; dgTrimmerTempSet = 0.0F; dgTrimmerTempCheckTimerCtr = 0; - dgActiveReservoirSet = DG_RESERVOIR_2; - dgActiveReservoir = DG_RESERVOIR_2; + dgActiveReservoirSet = DG_RESERVOIR_1; + dgActiveReservoir = DG_RESERVOIR_1; dgReservoirFillVolumeTargetSet = 0; dgReservoirDrainVolumeTargetSet = 0; dgDialysateTemp = 0.0F; @@ -246,6 +247,11 @@ // Trigger alarm if not receiving new DG op mode message in timely manner checkDGDataFreshness( ALARM_ID_HD_DG_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE, &dgOpModeDataFreshFlag ); + if ( TRUE == isAlarmActive( ALARM_ID_HD_DG_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE ) ) + { + // we don't want to keep thinking DG is in a useful mode - set it to fault mode until DG is able to report its' true mode status + setDGOpMode( DG_MODE_FAUL, 0 ); + } // Check to see if DG has restarted checkDGRestart(); @@ -1055,17 +1061,17 @@ /*********************************************************************//** * @brief - * The cmdStartDGChememicalFlushDisinfect function sends a start chemical disinfect + * The cmdStartDGChemicalFlushDisinfect function sends a start chemical disinfect * flush command message to the DG. * @details Inputs: none * @details Outputs: start chemical disinfect flush mode command sent to DG. * @return none *************************************************************************/ -void cmdStartDGChememicalFlushDisinfect( void ) +void cmdStartDGChemicalFlushDisinfect( void ) { BOOL start = TRUE; dgCmdResp[ DG_CMD_START_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** @@ -1080,11 +1086,57 @@ { BOOL start = FALSE; dgCmdResp[ DG_CMD_STOP_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** * @brief + * The cmdStopDGActiveCool function sends a stop active cool command + * message to the DG. + * @details Inputs: none + * @details Outputs: stop active cool mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGActiveCool( void ) +{ + dgCmdResp[ DG_CMD_STOP_ACTIVE_COOL ].commandID = DG_CMD_NONE; + sendDGStopActiveCoolModeCommand(); +} + +/*********************************************************************//** + * @brief + * The cmdStartDGROPermeateSampleMode function sends an RO permeate sample + * start command message to the DG. + * @details Inputs: none + * @details Outputs: start RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStartDGROPermeateSampleMode( void ) +{ + BOOL start = TRUE; + + dgCmdResp[ DG_CMD_START_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief + * The cmdStopDGROPermeateSampleMode function sends an RO permeate sample + * stop command message to the DG. + * @details Inputs: none + * @details Outputs: stop RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGROPermeateSampleMode( void ) +{ + BOOL start = FALSE; + + dgCmdResp[ DG_CMD_STOP_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief * The cmdRequestDGConcentrateRatios function sends a request to DG to receive * the concentrate ratios. * @details Inputs: none @@ -1223,8 +1275,8 @@ * @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 + * @details Inputs: dgStartCommandSent, dgStarted, dgCurrentOpMode + * @details Outputs: dgStartCommandSent, dgStarted, triggers a fault alarm if DG restarted * @return none *************************************************************************/ static void checkDGRestart( void ) @@ -1241,6 +1293,7 @@ ( DG_MODE_FILL != dgCurrentOpMode ) && ( DG_MODE_DRAI != dgCurrentOpMode ) ) { activateAlarmNoData( ALARM_ID_HD_DG_RESTARTED_FAULT ); + dgStarted = FALSE; // do not want to re-trigger alarm after alarm is cleared } } }