Index: firmware/App/Services/Reservoirs.h =================================================================== diff -u -rdcd360fb4dc37db2dcbeb7fb14fb327fe68235f4 -r3b70632c04247a6973960e1f37ae73eb4384a6b7 --- firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision dcd360fb4dc37db2dcbeb7fb14fb327fe68235f4) +++ firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision 3b70632c04247a6973960e1f37ae73eb4384a6b7) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2022 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Reservoirs.h * -* @author (last) Dara Navaei -* @date (last) 01-Nov-2021 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Sean * @date (original) 18-Mar-2020 @@ -33,43 +33,63 @@ // ********** public definitions ********** #define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. +#define RESERVOIR_EXTRA_TEMPERATURE 2.0F ///< Reservoirs extra margin temperature. -#pragma pack(push,1) - /// Fill command data structure. typedef struct { - U32 fillToVolumeMl; ///< Target volume to fill to (in mL) - U32 cmd; ///< General command (start/stop) + U32 fillToVolumeMl; ///< Target volume to fill to (in mL) + U32 cmd; ///< General command (start/stop) + F32 targetFlowLPM; ///< Target flow rate L/min } FILL_CMD_T; /// Drain command data structure. typedef struct { - U32 targetVolume; ///< Target volume to drain to (in mL) - BOOL tareLoadCell; ///< Flag to tare load call - BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines or not - U32 cmd; ///< General command (start/stop) + U32 targetVolume; ///< Target volume to drain to (in mL) + BOOL tareLoadCell; ///< Flag to tare load call + BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines or not + U32 cmd; ///< General command (start/stop) } DRAIN_CMD_T; /// DG command response data record. 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; +/// 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; ///< Wait to switch active reservoir time in milliseconds + F32 dialysateFlowLPM; ///< Dialysate flow rate in L/min +} DG_CMD_DIALYSATE_HEATING_PARAMS_T; + /// Reservoir data struct. typedef struct { - U32 activeReservoir; ///< Active reservoir ID - U32 fillToVolumeMl; ///< Volume target to fill to - U32 drainToVolumeMl; ///< Volume target to drain to + U32 activeReservoir; ///< Active reservoir ID + U32 fillToVolumeMl; ///< Volume target to fill to + U32 drainToVolumeMl; ///< Volume target to drain to + U32 timeReservoirCycleMS; ///< Reservoir cycle time in milliseconds + U32 timeReservoirFill2SwitchMS; ///< Reservoir fill to switch time in milliseconds + F32 timeUFDecayMS; ///< Ultrafilter temperature decay time in milliseconds + F32 tempUFFill; ///< Ultrafilter fill time in milliseconds + F32 tempReservoirUseActual; ///< Reservoir actual temperature + F32 tempReservoirEndFill; ///< Reservoir end fill temperature + F32 tempAvgFill; ///< Average fill temperature + F32 tempLastFill; ///< Last fill temperature + F32 timereservoirFill; ///< 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. } RESERVOIR_DATA_T; -#pragma pack(pop) - // ********** public function prototypes ********** void initReservoirs( void ); @@ -79,30 +99,37 @@ void setActiveReservoirCmd( DG_RESERVOIR_ID_T resID ); // handle switch reservoirs command from HD void changeValveSettingCmd( DG_VALVE_SETTING_ID_T valveSettingID ); // handle valve setting change command from HD -void startFillCmd( U32 fillToVolMl ); // handle fill command from HD +void startFillCmd( U32 fillToVolMl, F32 fillTargetFlowLPM ); // handle fill command from HD void stopFillCmd( void ); // handle stop fill command from HD void startDrainCmd( DRAIN_CMD_T drainCmd ); // handle drain command from HD void stopDrainCmd( void ); // handle stop drain command from HD -void tareReservoir( void ); -void resetReservoirsLowestWeight( void ); - DG_RESERVOIR_ID_T getInactiveReservoir( void ); -F32 getReservoirWeight( DG_RESERVOIR_ID_T reservoirId ); +F32 getReservoirWeight( DG_RESERVOIR_ID_T reservoirId ); +void setDialysateHeatingParameters( DG_CMD_DIALYSATE_HEATING_PARAMS_T params ); +U32 getTargetFillVolumeML( void ); +F32 getTargetFillFlowRateLPM( void ); +F32 getReservoirActualTemperature( void ); +F32 getPrimaryHeaterTargetTemperature( void ); +F32 getTrimmerHeaterTargetTemperature( void ); +F32 getTargetDialysateFlowLPM( void ); + DG_RESERVOIR_VOLUME_RECORD_T getReservoirsCalRecord( void ); BOOL hasTargetFillVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId ); BOOL hasTargetDrainVolumeBeenReached( DG_RESERVOIR_ID_T reservoirId, U32 timeout ); void tareLoadCellsAtEmpty( DG_RESERVOIR_ID_T reservoirId ); BOOL isReservoirTarePending( void ); +void initDrainParameters( DG_RESERVOIR_ID_T reservoirId ); BOOL testSetDGActiveReservoirOverride( DG_RESERVOIR_ID_T value ); BOOL testResetDGActiveReservoirOverride( void ); BOOL testSetReservoirFillVolumeMlOverride( U32 value ); BOOL testResetReservoirFillVolumeMlOverride( void ); BOOL testSetReservoirDrainVolumeMlOverride( U32 value ); -BOOL testResetReservoirDrainVolumeMlOverride( void ); +BOOL testResetReservoirDrainVolumeMlOverride( void ); +BOOL testTareReservoir( U32 value ); /**@}*/