Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r437ac340cfe0bd90bc016372113bae3d594b7526 -r526e890e4e35fac0a622af538bf611ea15a30609 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 437ac340cfe0bd90bc016372113bae3d594b7526) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 526e890e4e35fac0a622af538bf611ea15a30609) @@ -7,8 +7,8 @@ * * @file DGInterface.c * -* @author (last) Sean Nash -* @date (last) 13-Apr-2023 +* @author (last) Dara Navaei +* @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(); @@ -1269,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 ) @@ -1287,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 } } }