Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r098272da7396d05816a266142e7a34b40f4d93d3 -r632b2d868efba2aca7c694a9ff648753804a9671 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 098272da7396d05816a266142e7a34b40f4d93d3) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 632b2d868efba2aca7c694a9ff648753804a9671) @@ -7,8 +7,8 @@ * * @file DGInterface.h * -* @author (last) Dara Navaei -* @date (last) 13-Jul-2022 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -32,80 +32,98 @@ // ********** public definitions ********** -#define DEFAULT_TARGET_FILL_FLOW_RATE_LPM 0.8F ///< Default target fill flow rate in L/min. -#define DRAIN_RESERVOIR_TO_VOLUME_ML 0 ///< Drain reservoir to this volume (in mL) during treatment. -#define LOAD_CELL_PRIMARY_BACKUP_MAX_ALLOWED_DRIFT_GRAMS 10.0F ///< Reservoir load cell drift difference allowed -#define LOAD_CELL_ILLEGAL_WEIGHT_VALUE -10000.0F ///< Initial value for Load Cells, known bad value +#define DEFAULT_TARGET_FILL_FLOW_RATE_LPM 0.8F ///< Default target fill flow rate in L/min. +#define DRAIN_RESERVOIR_TO_VOLUME_ML 0 ///< Drain reservoir to this volume (in mL) during treatment. +#define LOAD_CELL_PRIMARY_BACKUP_MAX_ALLOWED_DRIFT_GRAMS 10.0F ///< Reservoir load cell drift difference allowed +#define LOAD_CELL_ILLEGAL_WEIGHT_VALUE -10000.0F ///< Initial value for Load Cells, known bad value /// DG Concentrate ratios data structure. typedef struct { - F32 acidMixingRatio; ///< Acid mixing ratio - F32 bicarbMixingRatio; ///< Bicarb mixing ratio - U32 timeFillPrepMS; ///< Fill prepare time in milliseconds + F32 acidMixingRatio; ///< Acid mixing ratio + F32 bicarbMixingRatio; ///< Bicarb mixing ratio + U32 timeFillPrepMS; ///< Fill prepare time in milliseconds } DG_MIXING_RATIOS_T; -/// Dialysate flow meter data structure. -typedef struct -{ - F32 measuredDialysateFlowRate; ///< Dialysate flow meter rate average measurement -} DIALYSATE_FLOW_METER_DATA_T; - /// Payload record structure for a reservoirs data message. typedef struct { - U32 resID; ///< Active reservoir ID - U32 setFillToVolumeMl; ///< Reservoir set fill to target volume in ml - U32 setDrainToVolumeMl; ///< Reservoir set drain to target volume in ml - U32 timeReservoirCycleMS; ///< Reservoir time cycle in milliseconds - U32 timeReservoirFill2SwitchMS; ///< Reservoir time fill to switch in milliseconds - F32 timeUFDecayMS; ///< Ultrafilter decay time in milliseconds - F32 tempUFFill; ///< Ultrafilter fill temperature in C - F32 tempReservoirUseActual; ///< Reservoir actual use temperature in C - F32 tempReservoirEndFill; ///< Reservoir end of the fill temperature in C - F32 tempAvgFill; ///< Average fill temperature in C - F32 tempLastFill; ///< Last fill temperature in C - F32 timereservoirFillMS; ///< Reservoir fill time in milliseconds - F32 tempRsrvr0ActualTrimmer; ///< Temperature actual reservoir in C. - F32 tempFillMixAvgTrimmer; ///< Temperature fill mix average trimmer in C. - F32 tempRsrvrEndFillTrimmer; ///< Temperature reservoir end fill trimmer in C. + U32 resID; ///< Active reservoir ID + U32 setFillToVolumeMl; ///< Reservoir set fill to target volume in ml + U32 setDrainToVolumeMl; ///< Reservoir set drain to target volume in ml + U32 timeReservoirCycleMS; ///< Reservoir time cycle in milliseconds + U32 timeReservoirFill2SwitchMS; ///< Reservoir time fill to switch in milliseconds + F32 timeUFDecayMS; ///< Ultrafilter decay time in milliseconds + F32 tempUFFill; ///< Ultrafilter fill temperature in C + F32 tempReservoirUseActual; ///< Reservoir actual use temperature in C + F32 tempReservoirEndFill; ///< Reservoir end of the fill temperature in C + F32 tempAvgFill; ///< Average fill temperature in C + F32 tempLastFill; ///< Last fill temperature in C + F32 timereservoirFillMS; ///< Reservoir fill time in milliseconds + F32 tempRsrvr0ActualTrimmer; ///< Temperature actual reservoir in C. + F32 tempFillMixAvgTrimmer; ///< Temperature fill mix average trimmer in C. + F32 tempRsrvrEndFillTrimmer; ///< Temperature reservoir end fill trimmer in C. } DG_RESERVOIRS_DATA_PAYLOAD_T; /// Payload record structure for a drain reservoir command message. typedef struct { - U32 drainToVolumeML; ///< Drain to target volume in ml - BOOL tareLoadCells; ///< Flag indicates to tare load cells or not - BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines or not - BOOL cmd; ///< Flag indicates to start or stop the drain mode + U32 drainToVolumeML; ///< Drain to target volume in ml + BOOL tareLoadCells; ///< Flag indicates to tare load cells or not + BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines or not + BOOL cmd; ///< Flag indicates to start or stop the drain mode } DRAIN_RESERVOIR_CMD_PAYLOAD_T; /// DG command response data record structure. typedef struct { - U32 commandID; ///< The command DG is responding to - BOOL rejected; ///< Flag indicates if the command has been rejected - U32 rejectCode; ///< Reason code for rejecting the command + U32 commandID; ///< The command DG is responding to + BOOL rejected; ///< Flag indicates if the command has been rejected + U32 rejectCode; ///< Reason code for rejecting the command } DG_CMD_RESPONSE_T; /// DG heat/chemical disinfects and flush state for UI structure. typedef struct DG_Disinfects { - U32 chemDisinfectUIState; ///< DG chemical disinfect UI state - U32 heatDisinfectUIState; ///< DG heat disinfect UI state - U32 flushUIState; ///< DG flush UI state + U32 chemDisinfectUIState; ///< DG chemical disinfect UI state + U32 heatDisinfectUIState; ///< DG heat disinfect UI state + U32 flushUIState; ///< DG flush UI state } DG_DISINFECT_UI_STATES_T; /// Dialysate heating parameters typedef struct { - F32 trimmerTargetTemperature; ///< Trimmer target temperature - U32 timeReservoirCycleMS; ///< Reservoir cycle time in milliseconds - F32 timeReservoirFillMS; ///< Reservoir fill time in milliseconds - U32 timeReservoirWait2SwitchMS; ///< Reservoir wait to switch time in milliseconds - F32 dialysateFlowLPM; ///< Dialysate flow in L/min + F32 trimmerTargetTemperature; ///< Trimmer target temperature + U32 timeReservoirCycleMS; ///< Reservoir cycle time in milliseconds + F32 timeReservoirFillMS; ///< Reservoir fill time in milliseconds + U32 timeReservoirWait2SwitchMS; ///< Reservoir wait to switch time in milliseconds + F32 dialysateFlowLPM; ///< Dialysate flow in L/min } DG_CMD_DIALYSATE_HEATING_PARAMS_T; +/// HD version of DG service record +typedef struct +{ + U32 lastServiceDateEpoch; ///< Last service date in epoch + U32 serviceIntervalSeconds; ///< Service interval in seconds +} HD_VERSION_DG_SERVICE_RECORD_T ; + +/// HD version of DG usage info +typedef struct +{ + U32 lastHeatDisDateEpoch; ///< Last heat disinfect date in epoch + U32 lastChemicalDisDateEpoch; ///< Last chemical disinfect date in epoch + BOOL isDisinfected; ///< Flag to indicate whether DG is disinfected or not +} HD_VERSION_DG_USAGE_INFO_T; + +/// HD version of the DG service record +typedef struct +{ + HD_VERSION_DG_SERVICE_RECORD_T dgServiceRecord; ///< HD version of the DG service record. + HD_VERSION_DG_USAGE_INFO_T dgUsageInfo; ///< HD version of the DG usage info. + BOOL isDGServiceRecordAvailable; ///< Flag to indicate DG service record is available. + BOOL isDGUsageInfoAviable; ///< Flag to indicate DG usage info is available. +} DG_SERVICE_AND_USAGE_DATA_T; + // ********** public function prototypes ********** void initDGInterface( void ); @@ -127,7 +145,9 @@ F32 getReservoirBackupWeightLargeFilter( DG_RESERVOIR_ID_T resID ); F32 getDialysateTemperature( void ); DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ); +F32 getDialysateTemperature( void ); DG_MIXING_RATIOS_T getDGMixingRatios( void ); +void getHDVersionDGServiceAndUsageData( DG_SERVICE_AND_USAGE_DATA_T* data ); void setDGOpMode( U32 opMode, U32 subMode ); void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ); @@ -136,6 +156,9 @@ void setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ); void setDGDisinfectsStates( DG_DISINFECT_UI_STATES_T states ); void setDGMixingRatios( DG_MIXING_RATIOS_T ratios ); +void setDGHeatersData( HEATERS_DATA_T *data ); +void setHDVersionDGServiceRecord( HD_VERSION_DG_SERVICE_RECORD_T* data ); +void setHDVersionDGUsageInfo( HD_VERSION_DG_USAGE_INFO_T* data ); void cmdSetDGDialysateHeatingParams( DG_CMD_DIALYSATE_HEATING_PARAMS_T heatingParams ); void cmdStartDG( void ); @@ -155,6 +178,7 @@ void cmdStartDGChemicalDisinfect( void ); void cmdStopDGChemicalDisinfect( void ); void cmdRequestDGMixingRatios( void ); +void cmdSetDGToServiceMode( void ); void handleDGCommandResponse( DG_CMD_RESPONSE_T *dgCmdRespPtr ); BOOL getDGCommandResponse( U32 commandID, DG_CMD_RESPONSE_T *cmdRespPtr );