Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r722eb364d9b8d1fa9cc98da41f09c5fd73a8be39 -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 722eb364d9b8d1fa9cc98da41f09c5fd73a8be39) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,47 +1,50 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2021-2024 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 SyringePump.h +* @file SyringePump.h * -* @author (last) Sean Nash -* @date (last) 02-Mar-2021 +* @author (last) Sean Nash +* @date (last) 31-Aug-2023 * -* @author (original) Sean Nash -* @date (original) 02-Mar-2021 +* @author (original) Sean Nash +* @date (original) 04-Mar-2021 * ***************************************************************************/ - -#ifndef __SYRINGE_PUMP_H__ -#define __SYRINGE_PUMP_H__ - -#include "HDCommon.h" + +#ifndef __SYRINGE_PUMP_H__ +#define __SYRINGE_PUMP_H__ + +#include "HDCommon.h" #include "HDDefs.h" - -/** - * @defgroup SyringePump SyringePump - * @brief Syringe pump controller/monitor module. Controls the syringe pump - * and monitors status. - * - * @addtogroup SyringePump - * @{ - */ - -// ********** public definitions ********** - + +/** + * @defgroup SyringePump SyringePump + * @brief Syringe pump controller/monitor module. Controls the syringe pump + * and monitors status. + * + * @addtogroup SyringePump + * @{ + */ + +// ********** public definitions ********** + +#define SYRINGE_PUMP_PRIME_VOLUME_ML 0.353F ///< Target syringe prime volume (in mL). +#define SYRINGE_PUMP_FILL_VOLUME_OFFSET_ML 0.8F ///< Advised fill volume offset due to HW variance. + /// Enumeration of syringe pump operations. typedef enum SyringePumpOperations { - SYRINGE_PUMP_OP_STOP = 0, - SYRINGE_PUMP_OP_RETRACT = 1, - SYRINGE_PUMP_OP_SEEK = 2, - SYRINGE_PUMP_OP_PRIME = 3, - SYRINGE_PUMP_OP_BOLUS = 4, - SYRINGE_PUMP_OP_CONTINUOUS = 5, - NUM_OF_SYRINGE_PUMP_OPS + SYRINGE_PUMP_OP_STOP = 0, ///< Syringe pump stopped - no operation. + SYRINGE_PUMP_OP_RETRACT = 1, ///< Syringe pump retract operation. Retract to home postion. + SYRINGE_PUMP_OP_SEEK = 2, ///< Syringe pump seek operation. Seek syringe plunger. + SYRINGE_PUMP_OP_PRIME = 3, ///< Syringe pump prime operation. Prime Heparin line. + SYRINGE_PUMP_OP_BOLUS = 4, ///< Syringe pump bolus operation. Deliver bolus volume of Heparin. + SYRINGE_PUMP_OP_CONTINUOUS = 5, ///< Syringe pump continuous dispense operation. Deliver Heparin at set rate. + NUM_OF_SYRINGE_PUMP_OPS = 6 ///< Number of syringe pump operation. } SYRINGE_PUMP_OPERATION_T; /// Payload record structure for the syringe pump operation request message. @@ -65,40 +68,58 @@ F32 syringePumpMeasSwitch; F32 syringePumpMeasForce; F32 syringePumpSafetyVolume; + U32 syringePumpStatus; } SYRINGE_PUMP_DATA_PAYLOAD_T; -// ********** public function prototypes ********** - -void initSyringePump( void ); +/// Heparin publish data structure +typedef struct +{ + F32 syringePumpVolumeDelivered; ///< Syringe pump volume delivered. + F32 syringePumpVolumeRequired; ///< Syringe pump volume required for therapy. +} SYRINGE_PUMP_VOLUME_DATA_T; + +// ********** public function prototypes ********** + +void initSyringePump( void ); void execSyringePump( void ); +SELF_TEST_STATUS_T execSyringePumpSelfTest( void ); + BOOL userHeparinRequest( HEPARIN_CMD_T cmd ); void setHeparinOff( void ); void setHeparinStopped( void ); void setHeparinCompleted( void ); HEPARIN_STATE_T getHeparinState( void ); +void resetPreLoadStatus( void ); void stopSyringePump( void ); BOOL retractSyringePump( void ); +BOOL preloadSyringePlunger( void ); BOOL seekSyringePlunger( void ); BOOL primeSyringePump( void ); +BOOL checkForSyringeOcclusion( BOOL stopPump ); BOOL startHeparinBolus( void ); BOOL startHeparinContinuous( void ); -BOOL setSyringePumpDACVref( F32 vRef ); +BOOL setSyringePumpDACVref( void ); +void syringeDetectionRequired( BOOL req ); +void syringePumpVerifyForceSensorDACCalibration( void ); BOOL isSyringeDetected( void ); BOOL isSyringePumpHome( void ); BOOL isSyringePumpStopped( void ); BOOL isSyringePlungerFound( void ); +BOOL isSyringeVolumeAdequate( void ); BOOL isSyringePumpPrimed( void ); +BOOL isSyringePumpRunning( void ); +BOOL isSyringePumpPreLoaded( void ); F32 getSyringePumpVolumeDelivered( void ); -SELF_TEST_STATUS_T execSyringePumpTest( void ); - -BOOL testSetSyringePumpDataPublishIntervalOverride( U32 value ); -BOOL testResetSyringePumpDataPublishIntervalOverride( void ); +BOOL testSetSyringePumpDataPublishIntervalOverride( U32 value ); +BOOL testResetSyringePumpDataPublishIntervalOverride( void ); BOOL testSyringePumpOperationRequest( SYRINGE_PUMP_OP_PAYLOAD_T opParams ); BOOL testSetSyringePumpMeasuredRateOverride( F32 value ); BOOL testResetSyringePumpMeasuredRateOverride( void ); +BOOL testSetHeprinBolusTargetRateOverride( F32 value ); +BOOL testResetHeprinBolusTargetRateOverride( void ); BOOL testSetSyringePumpMeasuredForceOverride( F32 value ); BOOL testResetSyringePumpMeasuredForceOverride( void ); BOOL testSetSyringePumpMeasuredSyringeDetectOverride( F32 value ); @@ -109,7 +130,15 @@ BOOL testResetSyringePumpMeasuredPositionOverride( void ); BOOL testSetSyringePumpMeasuredVolumeOverride( F32 value ); BOOL testResetSyringePumpMeasuredVolumeOverride( void ); - -/**@}*/ - -#endif +BOOL testSetSyringePumpStatus( U32 status ); +BOOL testResetSyringePumpStatus( void ); +BOOL testSetSyringePumpEncoderStatus( U32 status ); +BOOL testResetSyringePumpEncoderStatus( void ); +BOOL testSetSyringePumpADCandDACStatus( U32 status ); +BOOL testResetSyringePumpADCandDACStatus( void ); +BOOL testSetSyringePumpADCReadCounter( U32 ctr ); +BOOL testResetSyringePumpADCReadCounter( void ); + +/**@}*/ + +#endif