Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r9f39dcb0a661d2623ce48a3793c898524f6dbc6e -rf953f3b83163b118fdd8fa37c229a118bdd040f4 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 9f39dcb0a661d2623ce48a3793c898524f6dbc6e) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision f953f3b83163b118fdd8fa37c229a118bdd040f4) @@ -180,7 +180,7 @@ static OVERRIDE_F32_T syringePumpMeasHome = { 0.0, 0.0, 0.0, 0 }; ///< Measured optical home (in V). static OVERRIDE_S32_T syringePumpPosition = { 0, 0, 0, 0 }; ///< Encoder based position (in steps). static OVERRIDE_F32_T syringePumpVolumeDelivered = { 0.0, 0.0, 0.0, 0 }; ///< Measured volume delivered (in mL). -static OVERRIDE_F32_T heparinBolusTargetRate = { 40.0, 0.0, 0.0, 0 }; ///< Target rate of the heprin bolus in mL/hour +static OVERRIDE_F32_T heparinBolusTargetRate = { HEPARIN_BOLUS_TARGET_RATE, 0.0, 0.0, 0 }; ///< Target rate of the heprin bolus in mL/hour static OVERRIDE_U32_T syringePumpStatus = {0, 0, 0, 0}; ///< Syringe pump status reported by FPGA. static OVERRIDE_U32_T syringePumpEncoderStatus = {0, 0, 0, 0}; ///< Syringe pump encoder status reported by FPGA. @@ -233,10 +233,12 @@ static F32 getSyringePumpSyringeDetectorV( void ); static F32 getSyringePumpHomeDetectorV( void ); static F32 getSyringePumpForceV( void ); +static F32 getHeprinBolusTargetRate( void ); static U08 getSyringePumpStatus( void ); static U08 getSyringePumpEncoderStatus( void ); static U08 getSyringePumpADCReadCounter( void ); static U08 getSyringePumpADCandDACStatus( void ); + static SYRINGE_PUMP_STATE_T handleSyringePumpInitState( void ); static SYRINGE_PUMP_STATE_T handleSyringePumpOffState( void ); static SYRINGE_PUMP_STATE_T handleSyringePumpRetractState( void ); @@ -642,14 +644,7 @@ *************************************************************************/ F32 getSyringePumpVolumeDelivered( void ) { - F32 result = syringePumpVolumeDelivered.data; - - if ( OVERRIDE_KEY == syringePumpVolumeDelivered.override ) - { - result = syringePumpVolumeDelivered.ovData; - } - - return result; + return getF32OverrideValue( &syringePumpVolumeDelivered ); } /*********************************************************************//** @@ -662,38 +657,11 @@ *************************************************************************/ static F32 getSyringePumpMeasRate( void ) { - F32 result = syringePumpMeasRate.data; - - if ( OVERRIDE_KEY == syringePumpMeasRate.override ) - { - result = syringePumpMeasRate.ovData; - } - - return result; + return getF32OverrideValue( &syringePumpMeasRate ); } /*********************************************************************//** * @brief - * The getSyringePumpPosition function gets the current syringe pump - * position. - * @details Inputs: syringePumpPosition - * @details Outputs: none - * @return the current syringe pump syringe position (in steps). - *************************************************************************/ -static S32 getSyringePumpPosition( void ) -{ - S32 result = syringePumpPosition.data; - - if ( OVERRIDE_KEY == syringePumpPosition.override ) - { - result = syringePumpPosition.ovData; - } - - return result; -} - -/*********************************************************************//** - * @brief * The getSyringePumpSyringeDetectorV function gets the current syringe pump * syringe detect signal. * @details Inputs: syringePumpMeasSyringeDetectionSwitch @@ -702,14 +670,7 @@ *************************************************************************/ static F32 getSyringePumpSyringeDetectorV( void ) { - F32 result = syringePumpMeasSyringeDetectionSwitch.data; - - if ( OVERRIDE_KEY == syringePumpMeasSyringeDetectionSwitch.override ) - { - result = syringePumpMeasSyringeDetectionSwitch.ovData; - } - - return result; + return getF32OverrideValue( &syringePumpMeasSyringeDetectionSwitch ); } /*********************************************************************//** @@ -722,14 +683,7 @@ *************************************************************************/ static F32 getSyringePumpHomeDetectorV( void ) { - F32 result = syringePumpMeasHome.data; - - if ( OVERRIDE_KEY == syringePumpMeasHome.override ) - { - result = syringePumpMeasHome.ovData; - } - - return result; + return getF32OverrideValue( &syringePumpMeasHome ); } /*********************************************************************//** @@ -741,14 +695,33 @@ *************************************************************************/ static F32 getSyringePumpForceV( void ) { - F32 result = syringePumpMeasForce.data; + return getF32OverrideValue( &syringePumpMeasForce ); +} - if ( OVERRIDE_KEY == syringePumpMeasForce.override ) - { - result = syringePumpMeasForce.ovData; - } +/*********************************************************************//** + * @brief + * The getHeprinBolusTargetRate function gets the heprin bolus target + * flow rate. + * @details Inputs: getHeprinBolusTargetRate + * @details Outputs: getHeprinBolusTargetRate + * @return the current target heprin bolus flow rate (in mL/hour). + *************************************************************************/ +static F32 getHeprinBolusTargetRate( void ) +{ + return getF32OverrideValue( &heparinBolusTargetRate ); +} - return result; +/*********************************************************************//** + * @brief + * The getSyringePumpPosition function gets the current syringe pump + * position. + * @details Inputs: syringePumpPosition + * @details Outputs: none + * @return the current syringe pump syringe position (in steps). + *************************************************************************/ +static S32 getSyringePumpPosition( void ) +{ + return getS32OverrideValue( &syringePumpPosition ); } /*********************************************************************//** @@ -760,14 +733,7 @@ *************************************************************************/ static U08 getSyringePumpStatus() { - U08 result = (U08)(syringePumpStatus.data & MASK_OFF_U32_MSBS); - - if ( OVERRIDE_KEY == syringePumpStatus.override ) - { - result = (U08)(syringePumpStatus.ovData & MASK_OFF_U32_MSBS); - } - - return result; + return getU08OverrideValue( &syringePumpStatus ); } /*********************************************************************//** @@ -780,14 +746,7 @@ *************************************************************************/ static U08 getSyringePumpEncoderStatus() { - U08 result = (U08)(syringePumpEncoderStatus.data & MASK_OFF_U32_MSBS); - - if ( OVERRIDE_KEY == syringePumpEncoderStatus.override ) - { - result = (U08)(syringePumpEncoderStatus.ovData & MASK_OFF_U32_MSBS); - } - - return result; + return getU08OverrideValue( &syringePumpEncoderStatus ); } /*********************************************************************//** @@ -800,14 +759,7 @@ *************************************************************************/ static U08 getSyringePumpADCReadCounter() { - U08 result = (U08)(syringePumpADCReadCtr.data & MASK_OFF_U32_MSBS); - - if ( OVERRIDE_KEY == syringePumpADCReadCtr.override ) - { - result = (U08)(syringePumpADCReadCtr.ovData & MASK_OFF_U32_MSBS); - } - - return result; + return getU08OverrideValue( &syringePumpADCReadCtr ); } /*********************************************************************//** @@ -820,14 +772,7 @@ *************************************************************************/ static U08 getSyringePumpADCandDACStatus() { - U08 result = (U08)(syringePumpADCandDACStatus.data & MASK_OFF_U32_MSBS); - - if ( OVERRIDE_KEY == syringePumpADCandDACStatus.override ) - { - result = (U08)(syringePumpADCandDACStatus.ovData & MASK_OFF_U32_MSBS); - } - - return result; + return getU08OverrideValue( &syringePumpADCandDACStatus ); } /*********************************************************************//** @@ -1898,19 +1843,6 @@ /*********************************************************************//** * @brief - * The getHeprinBolusTargetRate function gets the heprin bolus target - * flow rate. - * @details Inputs: getHeprinBolusTargetRate - * @details Outputs: getHeprinBolusTargetRate - * @return the current target heprin bolos flow rate (in mL/hour). - *************************************************************************/ -F32 getHeprinBolusTargetRate( void ) -{ - return getF32OverrideValue( &heparinBolusTargetRate ); -} - -/*********************************************************************//** - * @brief * The processCalibrationData function gets the calibration data and makes * sure it is valid by checking the calibration date. The calibration date * should not be 0. @@ -2363,10 +2295,9 @@ if ( TRUE == isTestingActivated() ) { - heparinBolusTargetRate.data = heparinBolusTargetRate.ovInitData; heparinBolusTargetRate.override = OVERRIDE_RESET; + heparinBolusTargetRate.ovData = heparinBolusTargetRate.ovInitData; heparinBolusTargetRate.ovInitData = 0.0; - heparinBolusTargetRate.ovData = 0.0; result = TRUE; } @@ -2553,6 +2484,4 @@ return result; } - - /**@}*/ Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r1840d977fef9d794e9bc0840307da5f2ab2eb6ba -rf953f3b83163b118fdd8fa37c229a118bdd040f4 --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 1840d977fef9d794e9bc0840307da5f2ab2eb6ba) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision f953f3b83163b118fdd8fa37c229a118bdd040f4) @@ -98,7 +98,6 @@ BOOL isSyringePumpPrimed( void ); BOOL isSyringePumpRunning( void ); F32 getSyringePumpVolumeDelivered( void ); -F32 getHeprinBolusTargetRate( void ); BOOL testSetSyringePumpDataPublishIntervalOverride( U32 value ); BOOL testResetSyringePumpDataPublishIntervalOverride( void ); Index: firmware/source/sys_startup.c =================================================================== diff -u -r0621f9c7ae3ff48154f2397a31ba21b42c870023 -rf953f3b83163b118fdd8fa37c229a118bdd040f4 --- firmware/source/sys_startup.c (.../sys_startup.c) (revision 0621f9c7ae3ff48154f2397a31ba21b42c870023) +++ firmware/source/sys_startup.c (.../sys_startup.c) (revision f953f3b83163b118fdd8fa37c229a118bdd040f4) @@ -64,7 +64,6 @@ #include "errata_SSWF021_45.h" /* USER CODE BEGIN (1) */ -#include "reg_crc.h" /* USER CODE END */