Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rffaf9f13166d7a9beb4252fad804c488f870aaaa -r4d0c621f5994e1de8bf7d3337678f7835292ce73 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision ffaf9f13166d7a9beb4252fad804c488f870aaaa) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 4d0c621f5994e1de8bf7d3337678f7835292ce73) @@ -8,7 +8,7 @@ * @file DGInterface.c * * @author (last) Sean Nash -* @date (last) 07-Jul-2023 +* @date (last) 14-Aug-2023 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -17,7 +17,7 @@ #include // To check for NaN -#include "Battery.h" +#include "CPLD.h" #include "DialInFlow.h" #include "Dialysis.h" #include "DGDefs.h" @@ -96,14 +96,9 @@ 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. -static U32 dgReservoirDrainVolumeTarget = 0; ///< Latest drain-to volume reported by the DG. -static U32 dgReservoirDrainVolumeTargetSet = 0; ///< Drain-to volume commanded. - static DG_DISINFECT_UI_STATES_T disinfectsStatus; ///< DG disinfects status. static DG_MIXING_RATIOS_T dgMixingRatios; ///< DG mixing ratios. static HEATERS_DATA_T dgHeatersData; ///< DG heaters data. @@ -129,14 +124,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; - dgReservoirFillVolumeTargetSet = 0; - dgReservoirDrainVolumeTargetSet = 0; dgDialysateTemp = 0.0F; dgCurrentOpMode = DG_MODE_INIT; dgSubMode = 0; @@ -233,7 +227,7 @@ *************************************************************************/ void execDGInterfaceMonitor( void ) { - if ( isACPowerLost() != TRUE ) + if ( getCPLDACPowerLossDetected() != TRUE ) { // Trigger alarm if not receiving new load cell data message in timely manner checkDGDataFreshness( ALARM_ID_HD_NEW_LOAD_CELL_DATA_MESSAGE_NOT_RECEIVE, &dgLoadCellDataFreshFlag ); @@ -468,7 +462,7 @@ * The getDialysateTemperature function gets the latest dialysate temperature. * @details Inputs: dgDialysateTemp * @details Outputs: none - * @return the current dialysate temperature + * @return the latest dialysate temperature *************************************************************************/ F32 getDialysateTemperature( void ) { @@ -477,6 +471,19 @@ /*********************************************************************//** * @brief + * The getRedundantDialysateTemperature function gets the latest redundant + * dialysate temperature. + * @details Inputs: dgRedundantDialysateTemp + * @details Outputs: none + * @return the latest redundant dialysate temperature + *************************************************************************/ +F32 getRedundantDialysateTemperature( void ) +{ + return dgRedundantDialysateTemp; +} + +/*********************************************************************//** + * @brief * The getHeatDisinfectTemperatureSensorValue function gets the latest * heat disinfect temperature sensor value. * @details Inputs: dgDialysateTemp @@ -504,7 +511,7 @@ /*********************************************************************//** * @brief * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: none + * @details Inputs: disinfectsStatus * @details Outputs: none * @return the current DG disinfects readings *************************************************************************/ @@ -517,7 +524,7 @@ * @brief * The getDGMixingRatios function returns the DG mixing ratios and the fill * prep time. - * @details Inputs: none + * @details Inputs: dgMixingRatios * @details Outputs: none * @return getDGMixingRatios which is the DG mixing ratios *************************************************************************/ @@ -597,8 +604,7 @@ * The setDGReservoirsData function sets the latest reservoir data * reported by the DG. * @details Inputs: none - * @details Outputs: dgActiveReservoir, dgReservoirFillVolumeTarget, - * dgReservoirDrainVolumeTarget, dgReservoirsDataFreshFlag + * @details Outputs: dgActiveReservoir, dgReservoirsDataFreshFlag * @param resID ID of active reservoir * @param fillVol Reservoir fill to volume reported by DG * @param drainVol Reservoir drain to volume reported by DG @@ -609,8 +615,6 @@ if ( resID < NUM_OF_DG_RESERVOIRS ) { dgActiveReservoir = resID; - dgReservoirFillVolumeTarget = fillVol; - dgReservoirDrainVolumeTarget = drainVol; } else { @@ -908,7 +912,6 @@ void cmdStartDGFill( U32 fillToVolMl, F32 targetFlowLPM ) { dgCmdResp[ DG_CMD_START_FILL ].commandID = DG_CMD_NONE; - dgReservoirFillVolumeTargetSet = fillToVolMl; sendDGFillCommand( DG_CMD_START, fillToVolMl, targetFlowLPM ); } @@ -923,7 +926,6 @@ void cmdStopDGFill( void ) { dgCmdResp[ DG_CMD_STOP_FILL ].commandID = DG_CMD_NONE; - dgReservoirFillVolumeTargetSet = 0; sendDGFillCommand( DG_CMD_STOP, 0, 0 ); } @@ -947,7 +949,6 @@ payload.tareLoadCells = tareLoadCell; payload.rinseConcentrateLines = rinse; payload.cmd = start; - dgReservoirDrainVolumeTargetSet = drainToVolMl; sendDGDrainCommand( &payload ); } @@ -1310,7 +1311,7 @@ U32 trimmerState = dgHeatersData.trimmerHeaterState; DG_OP_MODE_T dgOp = getDGOpMode(); - if ( isACPowerLost() != TRUE ) + if ( getCPLDACPowerLossDetected() != TRUE ) { if ( ( DG_MODE_GENE == dgOp ) || ( DG_MODE_FILL == dgOp ) || ( DG_MODE_DRAI == dgOp ) ) {