Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -red4d9f0a8493695e63d4b226d1c3d885a00b7565 -r81c902fb595b9fcde229f8898d14e43312969f26 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision ed4d9f0a8493695e63d4b226d1c3d885a00b7565) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 81c902fb595b9fcde229f8898d14e43312969f26) @@ -145,15 +145,10 @@ static F32 shortFilteredArterialPressure; ///< Measured arterial pressure after short (1 s) filter. static F32 shortFilteredVenousPressure; ///< Measured venous pressure after short (1 s) filter. -static U32 airPumpOpenToleranceTimer; ///< Timer for increased maximum venous high limit. - static U32 bloodPumpOcclusionAfterCartridgeInstall; ///< Measured blood pump occlusion reading taken after cartridge install. static U32 emptySalineBagCtr = 0; ///< Timer counter for empty bag detection. -static U08 lastBPOcclReadCtr; ///< Previous BP occlusion sensor read count. -static U08 lastBPErrorCtr; ///< Previous BP error count. - static F32 artPressureReadingsLong[ SIZE_OF_LONG_ART_ROLLING_AVG ]; ///< Holds flow samples for long arterial pressure rolling average. static U32 artPressureReadingsLongIdx = 0; ///< Index for next sample in rolling average array. static F32 artPressureReadingsLongTotal = 0.0; ///< Rolling total - used to calc average. @@ -211,21 +206,12 @@ initFPGAPersistentAlarm( FPGA_PERS_ERROR_VENOUS_PRESSURE_SESNOR, ALARM_ID_HD_VENOUS_SENSOR_FPGA_FAULT, PRES_SENSORS_FPGA_ERROR_TIMEOUT_MS, PRES_SENSORS_FPGA_ERROR_TIMEOUT_MS ); -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - lastBPOcclReadCtr = 0; - lastBPErrorCtr = 0; - } - longFilteredArterialPressure = 0.0F; shortFilteredArterialPressure = 0.0F; shortFilteredVenousPressure = 0.0F; presOcclDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; presOcclState = PRESSURE_WAIT_FOR_POST_STATE; presOcclPostState = PRESSURE_SELF_TEST_STATE_START; - airPumpOpenToleranceTimer = 0; #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) @@ -458,15 +444,6 @@ // Record occlusion sensor readings bloodPumpOcclusion.data = (U32)getFPGABloodPumpOcclusion(); - -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - // Record occlusion read and error counters for next time around - lastBPOcclReadCtr = bpReadCtr; - lastBPErrorCtr = bpErrorCtr; - } } /*********************************************************************//** @@ -485,6 +462,8 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ARTERIAL_PRESSURE_CHECK ) != SW_CONFIG_ENABLE_VALUE ) #endif { + TREATMENT_STATE_T txState = getTreatmentState(); + // Check arterial pressure is in range if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, ( artPres > ARTERIAL_PRESSURE_MAX_MMHG || artPres < ARTERIAL_PRESSURE_MIN_MMHG ) ) ) @@ -494,7 +473,8 @@ // Check arterial pressure during treatment mode if ( ( MODE_TREA == getCurrentOperationMode() ) && - ( TREATMENT_DIALYSIS_STATE == getTreatmentState() ) && ( getDialysisState() != DIALYSIS_SALINE_BOLUS_STATE ) ) + ( ( TREATMENT_BLOOD_PRIME_STATE == txState ) || + ( ( TREATMENT_DIALYSIS_STATE == txState ) && ( getDialysisState() != DIALYSIS_SALINE_BOLUS_STATE ) ) ) ) { F32 artLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); F32 artHighLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -ra69df990617509469df4ab5763adff6c65b8157e -r81c902fb595b9fcde229f8898d14e43312969f26 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision a69df990617509469df4ab5763adff6c65b8157e) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 81c902fb595b9fcde229f8898d14e43312969f26) @@ -109,8 +109,6 @@ static SALINE_BOLUS_STATE_T handleSalineBolusInProgressState( DIALYSIS_STATE_T *dialysisState ); static SALINE_BOLUS_STATE_T handleSalineBolusMaxDeliveredState( DIALYSIS_STATE_T *dialysisState ); -static void startHeparinPump( void ); - static void checkUFAccuracyAndVolume( void ); static void updateUFVolumes( void ); @@ -259,7 +257,7 @@ * @details Outputs: Syringe pump started/stopped as appropriate * @return none *************************************************************************/ -static void startHeparinPump( void ) +void startHeparinPump( void ) { HEPARIN_STATE_T currentHeparinState = getHeparinState(); U32 preStop = getTreatmentParameterU32( TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME ); Index: firmware/App/Modes/Dialysis.h =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r81c902fb595b9fcde229f8898d14e43312969f26 --- firmware/App/Modes/Dialysis.h (.../Dialysis.h) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Modes/Dialysis.h (.../Dialysis.h) (revision 81c902fb595b9fcde229f8898d14e43312969f26) @@ -57,6 +57,7 @@ void setDialysisParams( U32 bPFlow, U32 dPFlow, F32 maxUFVol, F32 uFRate ); void stopDialysis( void ); +void startHeparinPump( void ); void signalStartSalineBolus( void ); void signalAbortSalineBolus( void ); Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r81c902fb595b9fcde229f8898d14e43312969f26 --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 81c902fb595b9fcde229f8898d14e43312969f26) @@ -37,8 +37,6 @@ /// Treatment stop status broadcast interval. #define TREATMENT_STOP_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) -/// Target flow rate for re-circulation of saline on blood-side circuit. -#define RECIRC_BP_FLOW_RATE_ML_MIN 100 // ********** private data ********** @@ -71,7 +69,7 @@ *************************************************************************/ void initTreatmentStop( void ) { - currentTxStopState = TREATMENT_STOP_RECIRC_STATE; + currentTxStopState = TREATMENT_STOP_RECIRC_STATE; // Assume blood and dialysate will recirculate initially - will stop pump(s) as appropriate in state machine bloodSittingTimerCtr = 0; stopPublishTimerCtr = TREATMENT_STOP_DATA_PUBLISH_INTERVAL; } @@ -102,9 +100,6 @@ setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); - // Ensure syringe pump is stopped - stopSyringePump(); - // Set Dialysate valves to bypass filter for recirculation setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); @@ -160,12 +155,23 @@ *************************************************************************/ static void setupForBloodRecirculationState( void ) { + PUMP_CONTROL_MODE_T mode = PUMP_CONTROL_MODE_CLOSED_LOOP; + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_BLOOD_PUMP_OPEN_LOOP ) ) + { + mode = PUMP_CONTROL_MODE_OPEN_LOOP; + } +#endif + doorClosedRequired( TRUE, TRUE ); // Open VBA and VBV valves to patient for blood recirculation setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); - // Start blood pump at re-circulate flow rate - setBloodPumpTargetFlowRate( RECIRC_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + // Start blood pump at prescribed flow rate + setBloodPumpTargetFlowRate( getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ), MOTOR_DIR_FORWARD, mode ); + // Start Heparin pump as appropriate + startHeparinPump(); // Start air trap leveling control startAirTrapControl(); // Reset blood sitting timer, it is now circulating @@ -201,6 +207,8 @@ { // Stop blood pump signalBloodPumpHardStop(); + // Stop syringe pump + stopSyringePump(); // Close arterial and venous lines setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); @@ -261,36 +269,34 @@ BOOL dialysateRecircBlocked = isDialysateRecircBlocked(); // Both unblocked and not in recirculate both state - if ( (TREATMENT_STOP_RECIRC_STATE != state) && ( FALSE == dialysateRecircBlocked ) - && ( FALSE == bloodRecircBlocked ) ) + if ( ( TREATMENT_STOP_RECIRC_STATE != state ) && ( FALSE == dialysateRecircBlocked ) && ( FALSE == bloodRecircBlocked ) ) { setupForBloodRecirculationState(); setupForDialysateRecirculationState(); result = TREATMENT_STOP_RECIRC_STATE; } // Both blocked and not in stopped state - if ( (TREATMENT_STOP_NO_RECIRC_STATE != state) && ( TRUE == dialysateRecircBlocked ) - && ( TRUE == bloodRecircBlocked ) ) + if ( ( TREATMENT_STOP_NO_RECIRC_STATE != state ) && ( TRUE == dialysateRecircBlocked ) && ( TRUE == bloodRecircBlocked ) ) { setupForBloodRecirculationStopState(); setupForDialysateRecirculationStopState(); result = TREATMENT_STOP_NO_RECIRC_STATE; } // Dialysate recirculation blocked and not in blood recirc state - if ( ( TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE != state ) - && ( TRUE == dialysateRecircBlocked ) - && ( FALSE == bloodRecircBlocked ) ) + if ( ( TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE != state ) && + ( TRUE == dialysateRecircBlocked ) && + ( FALSE == bloodRecircBlocked ) ) { setupForDialysateRecirculationStopState(); result = TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE; } // Blood recirculation blocked and not in dialysate recirc state - if ( ( TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE != state ) - && ( TRUE == bloodRecircBlocked ) - && ( FALSE == dialysateRecircBlocked ) ) + if ( ( TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE != state ) && + ( TRUE == bloodRecircBlocked ) && + ( FALSE == dialysateRecircBlocked ) ) { setupForBloodRecirculationStopState(); result = TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE;