Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -rb9bbcef1e828cf6537b41790d9871c3f25741494 -r7e86f5b6c5da2de71efd58a2d9bfcab43c426a08 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision b9bbcef1e828cf6537b41790d9871c3f25741494) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 7e86f5b6c5da2de71efd58a2d9bfcab43c426a08) @@ -180,6 +180,8 @@ 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_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. static OVERRIDE_U32_T syringePumpADCandDACStatus = {0, 0, 0, 0}; ///< Syringe pump ADC and DAC status reported by FPGA. @@ -554,15 +556,13 @@ *************************************************************************/ BOOL startHeparinBolus( void ) { - F32 tgtRate = HEPARIN_BOLUS_TARGET_RATE; // fixed rate - // If valid to start a bolus, kick it off if ( FALSE == isSyringePumpHome() ) { if ( ( TRUE == isSyringeDetected() ) && ( TRUE == syringePumpPrimeCompleted ) && ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( HEPARIN_STATE_STOPPED == heparinDeliveryState ) ) { - syringePumpSetRate = tgtRate; + syringePumpSetRate = getHeprinBolusTargetRate(); syringePumpBolusRequested = TRUE; } } @@ -1897,8 +1897,22 @@ } } + /*********************************************************************//** * @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. @@ -2314,6 +2328,55 @@ /*********************************************************************//** * @brief + * The testSetHeprinBolusTargetRateOverride function overrides the + * heprine bolus target rate. + * @details Inputs: heprinBolusTargetRate + * @details Outputs: heprinBolusTargetRate + * @param: value : override heprinBolusTargetRate (in mL/hour) + * @param: value : override heprinBolusTargetRate (in mL/hour) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetHeprinBolusTargetRateOverride( F32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + heparinBolusTargetRate.ovInitData = heparinBolusTargetRate.data; + heparinBolusTargetRate.ovData = value; + heparinBolusTargetRate.override = OVERRIDE_KEY; + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetHeprinBolusTargetRateOverride function resets the override + * of the heprin bolus target rate. + * @details Inputs: heprinBolusTargetRate + * @details Outputs: heprinBolusTargetRate + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testResetHeprinBolusTargetRateOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + heparinBolusTargetRate.data = heparinBolusTargetRate.ovInitData; + heparinBolusTargetRate.override = OVERRIDE_RESET; + heparinBolusTargetRate.ovInitData = 0.0; + heparinBolusTargetRate.ovData = 0.0; + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The testSetSyringePumpStatus function overrides the syringe pump * status. * @details Inputs: none @@ -2492,4 +2555,6 @@ return result; } + + /**@}*/