Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -raa7b1f5f68aae23c1c52b32658fcb625c29accfb -rd0e6b55d2fed933caec5ca8f5b8f19c7f4d7ecea --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision aa7b1f5f68aae23c1c52b32658fcb625c29accfb) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision d0e6b55d2fed933caec5ca8f5b8f19c7f4d7ecea) @@ -8,7 +8,7 @@ * @file DGInterface.c * * @author (last) Dara Navaei -* @date (last) 07-Nov-2022 +* @date (last) 02-Dec-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -37,18 +37,18 @@ // ********** 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 SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. +#define SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. -#define DIALYSATE_TEMP_OUT_OF_TARGET_TOL_C 2.0F ///< Dialysate temperature out of target tolerance C. -#define DIALYSATE_TEMP_OUT_OF_TARGET_TIMEOUT_MS ( 300 * MS_PER_SECOND ) ///< Dialysate temperature out of target timeout in milliseconds. -#define DIALYSATE_TEMP_HIGH_SAFETY_LIMIT_C 46.0F ///< Dialysate high safety temperature limit in C. -#define DIALYSATE_TEMP_HIGH_SAFETY_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< Dialysate temperature high safety timeout in milliseconds. -#define DIALYSATE_TEMP_LOW_SAFETY_LIMIT_C 42.0F ///< Dialysate low safety temperature limit in C. -#define DIALYSATE_TEMP_LOW_SAFETY_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Dialysate temperature low safety timeout in milliseconds. -#define DG_DATA_FRESHNESS_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< DG data freshness timeout (in ms). +#define DIALYSATE_TEMP_OUT_OF_TARGET_TOL_C 2.0F ///< Dialysate temperature out of target tolerance C. +#define DIALYSATE_TEMP_OUT_OF_TARGET_TIMEOUT_MS ( 300 * MS_PER_SECOND ) ///< Dialysate temperature out of target timeout in milliseconds. +#define DIALYSATE_TEMP_HIGH_SAFETY_LIMIT_C 46.0F ///< Dialysate high safety temperature limit in C. +#define DIALYSATE_TEMP_HIGH_SAFETY_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< Dialysate temperature high safety timeout in milliseconds. +#define DIALYSATE_TEMP_LOW_SAFETY_LIMIT_C 42.0F ///< Dialysate low safety temperature limit in C. +#define DIALYSATE_TEMP_LOW_SAFETY_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Dialysate temperature low safety timeout in milliseconds. +#define DG_DATA_FRESHNESS_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< DG data freshness timeout (in ms). // ********** private data ********** @@ -70,11 +70,10 @@ static U32 timeStartMS = 0; // TODO is this needed? // DG sensor data -static F32 dgDialysateTemp = 0.0; ///< Dialysate temperature reported by the DG. -static F32 dgRedundantDialysateTemp = 0.0; ///< Redundant dialysate temperature reported by the DG. -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. +static F32 dgDialysateTemp; ///< Dialysate temperature reported by the DG. +static F32 dgRedundantDialysateTemp; ///< Redundant dialysate temperature reported by the DG. +static F32 dgHeatDisinfectTemp; ///< Heat disinfect temperature reported by the DG. +static F32 dgTrimmerTempSet; ///< Trimmer heater target temperature commanded. /// Measured weight from load cells. static OVERRIDE_F32_T loadCellWeightInGrams[ NUM_OF_LOAD_CELLS ]; @@ -145,6 +144,7 @@ dgStartCommandSent = FALSE; dgDialysateFlowRateMlMin = 0.0F; dgDialysateFlowDataFreshFlag = FALSE; + dgHeatDisinfectTemp = 0.0F; // initialize load cell weights for ( i = 0; i < NUM_OF_LOAD_CELLS; i++ ) @@ -464,6 +464,19 @@ /*********************************************************************//** * @brief + * The getHeatDisinfectTemperatureSensorValue function gets the latest + * heat disinfect temperature sensor value. + * @details Inputs: dgDialysateTemp + * @details Outputs: none + * @return the current heat disinfect temperature sensor value + *************************************************************************/ +F32 getHeatDisinfectTemperatureSensorValue( void ) +{ + return dgHeatDisinfectTemp; +} + +/*********************************************************************//** + * @brief * The getDGDisinfectsStates function returns the DG disinfects readings. * @details Inputs: none * @details Outputs: none @@ -534,15 +547,16 @@ * @details Inputs: none * @details Outputs: dgDialysateTemp, dgRedundantDialysateTemp, * dgDialysateTemperatureDataFreshFlag - * @param temp1 dialysate temperature reported by DG - * @param temp2 redundant dialysate temperature reported by DG + * @param tdi dialysate temperature reported by DG + * @param tro redundant dialysate temperature reported by DG + * @param thd heat disinfect temperature sensor reported by DG * @return none *************************************************************************/ -void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ) +void setDialysateTemperatureReadings( F32 tdi, F32 tro, F32 thd ) { - dgDialysateTemp = temp1; - dgRedundantDialysateTemp = temp2; - + dgDialysateTemp = tdi; + dgRedundantDialysateTemp = tro; + dgHeatDisinfectTemp = thd; dgDialysateTemperatureDataFreshFlag = TRUE; } @@ -695,10 +709,10 @@ * record * @return none *************************************************************************/ -void setHDVersionDGServiceRecord( HD_VERSION_DG_SERVICE_RECORD_T* data ) +void setHDVersionDGServiceRecord( DG_SERVICE_RECORD_T* data ) { dgServiceAndUsageData.isDGServiceRecordAvailable = TRUE; - memcpy( &dgServiceAndUsageData.dgServiceRecord, data, sizeof( HD_VERSION_DG_SERVICE_RECORD_T ) ); + memcpy( &dgServiceAndUsageData.dgServiceRecord, data, sizeof( DG_SERVICE_RECORD_T ) ); } /*********************************************************************//** @@ -711,10 +725,10 @@ * info * @return none *************************************************************************/ -void setHDVersionDGUsageInfo( HD_VERSION_DG_USAGE_INFO_T* data ) +void setHDVersionDGUsageInfo( DG_USAGE_INFO_RECORD_T* data ) { dgServiceAndUsageData.isDGUsageInfoAviable = TRUE; - memcpy( &dgServiceAndUsageData.dgUsageInfo, data, sizeof( HD_VERSION_DG_USAGE_INFO_T ) ); + memcpy( &dgServiceAndUsageData.dgUsageInfo, data, sizeof( DG_USAGE_INFO_RECORD_T ) ); } /*********************************************************************//** @@ -1091,7 +1105,6 @@ { hasCommandResp = TRUE; memcpy( cmdRespPtr, &dgCmdResp[ commandID ], sizeof( DG_CMD_RESPONSE_T ) ); - dgCmdResp[ commandID ].commandID = DG_CMD_NONE; } return hasCommandResp;