Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -re4f2159406af470f7116c4d8ac510806261cb2dc -rc2415db7dd138b58958d7ae712f31c67bc30b821 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision e4f2159406af470f7116c4d8ac510806261cb2dc) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision c2415db7dd138b58958d7ae712f31c67bc30b821) @@ -81,6 +81,7 @@ #define PSI_TO_MMHG ( 51.7149F ) ///< Conversion factor for converting PSI to mmHg. +// The new arterial pressure sensor is the same as the venous pressure sensor #define VENOUS_PRESSURE_NORMAL_OP 0 ///< Venous pressure status bits indicate normal operation. #define VENOUS_PRESSURE_CMD_MODE 1 ///< Venous pressure status bits indicate sensor in command mode. #define VENOUS_PRESSURE_STALE_DATA 2 ///< Venous pressure status bits indicate data is stale (no new data since last fpga read). @@ -885,7 +886,6 @@ } } } - // Check for occlusion in Treatment modes where pumps are moving else if ( MODE_TREA == getCurrentOperationMode() ) { Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r4d509fa074423027c3106a209ead0beffd57cc3e -rc2415db7dd138b58958d7ae712f31c67bc30b821 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 4d509fa074423027c3106a209ead0beffd57cc3e) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c2415db7dd138b58958d7ae712f31c67bc30b821) @@ -888,7 +888,6 @@ // Reset bolus data before we start bolusSalineVolumeDelivered_mL = 0.0; bolusSalineLastVolumeTimeStamp = getMSTimerCount(); - // Bypass dialyzer setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); Index: firmware/App/Modes/TreatmentRecirc.c =================================================================== diff -u -r4d509fa074423027c3106a209ead0beffd57cc3e -rc2415db7dd138b58958d7ae712f31c67bc30b821 --- firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision 4d509fa074423027c3106a209ead0beffd57cc3e) +++ firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision c2415db7dd138b58958d7ae712f31c67bc30b821) @@ -51,10 +51,12 @@ static BOOL recircBackToTreatmenRequested; ///< Flag indicates user requesting to go back to treatment (confirming re-connected). static BOOL recircResumeRequested; ///< Flag indicates user requesting resumption of re-circulating. static BOOL recircEndTreatmentRequested; ///< Flag indicates user requesting end of treatment. - +static BOOL dialysateRecircBlocked; ///< Flag indicates previous user stop dialysate recirulation condition +static BOOL bloodRecircBlocked; ///< Flag indicates previous user stop blood recirculation condition // ********** private function prototypes ********** static void resetTreatmentRecircFlags( void ); +static void setFullStop( void ); static void setupForRecirculationState( void ); static void setupForRecirculationStopState( void ); @@ -63,6 +65,7 @@ static TREATMENT_RECIRC_STATE_T handleRecircRecircState( void ); static TREATMENT_RECIRC_STATE_T handleRecircStoppedState( void ); static TREATMENT_RECIRC_STATE_T handleRecircReconnectPatientState( void ); +static TREATMENT_RECIRC_STATE_T handleTreatmentRecircOnOff( TREATMENT_RECIRC_STATE_T result ); static BOOL handleRecircReconnectUserAction( REQUEST_REJECT_REASON_CODE_T *rejReason ); static BOOL handleRecicConfirmReconnectUserAction( REQUEST_REJECT_REASON_CODE_T *rejReason ); @@ -85,6 +88,8 @@ recircTimerCtr = 0; recircPublishTimerCtr = 0; resetTreatmentRecircFlags(); + dialysateRecircBlocked = isDialysateRecircBlocked(); + bloodRecircBlocked = isBloodRecircBlocked(); } /*********************************************************************//** @@ -105,6 +110,39 @@ /*********************************************************************//** * @brief + * The setFullStop function stops all HD activity. This function will be + * called by rinseback mode when an alarm (stop, noBloodRecirc, + * noDialysateRecirc) occurs or the user pressed the stop button. + * Rinseback may be resumed later. + * @details Inputs: none + * @details Outputs: Blood and dialysate pumps stopped. Heparin pump stopped. + * @return none + *************************************************************************/ +static void setFullStop( void ) +{ + // Tell DG to stop heating dialysate + cmdStopDGTrimmerHeater(); + + // Stop the peristaltic pumps + signalDialInPumpHardStop(); + signalDialOutPumpHardStop(); + signalBloodPumpHardStop(); + + // Set valves to safe state + // Dialysate in bypass + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + // patient blood lines closed + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + + // Stop the ancillary pumps + stopSyringePump(); + endAirTrapControl(); +} + +/*********************************************************************//** + * @brief * The transitionToTreatmentRecirc function prepares for transition to treatment * re-circulate sub-mode. * @details Inputs: none @@ -122,8 +160,8 @@ setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); setupForRecirculationStopState(); - // Enable venous bubble detection while recirculating - setVenousBubbleDetectionEnabled( TRUE ); + // Disable venous bubble detection while recirculating + setVenousBubbleDetectionEnabled( FALSE ); // Ensure syringe pump is stopped stopSyringePump(); @@ -170,6 +208,7 @@ { // Stop blood pump signalBloodPumpHardStop(); + // Close arterial and venous lines setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); @@ -223,6 +262,10 @@ // Broadcast recirc status publishTreatmentRecircData(); + + // Start/stop dialysate recirculation during rinseback mode based on active alarms that would block it + treatmentRecircState = handleTreatmentRecircOnOff( treatmentRecircState ); + } /*********************************************************************//** @@ -522,6 +565,37 @@ /*********************************************************************//** * @brief + * The handleTreatmentRecircOnOff function starts/stops recirculation + * during rinseback sub-mode based on active alarm properties. + * Simplified case for user stop - all stop/all go states only. + * @details Inputs: none + * @details Outputs: dialysate recirculation started or stopped as appropriate + * @return none + *************************************************************************/ +static TREATMENT_RECIRC_STATE_T handleTreatmentRecircOnOff( TREATMENT_RECIRC_STATE_T result ) +{ + // if there was any change + if ( ( dialysateRecircBlocked != isDialysateRecircBlocked() ) || ( bloodRecircBlocked != isBloodRecircBlocked() ) ) + { // Stop recirc if blocked by alarm + if ( ( TRUE == isDialysateRecircBlocked() ) && ( TRUE == isBloodRecircBlocked() ) ) + { + setFullStop( ); + result = TREATMENT_RECIRC_STOPPED_STATE; + } + else if ( ( isDialysateRecircBlocked() != TRUE ) && ( isBloodRecircBlocked() != TRUE ) ) + { + setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + cmdStartDGTrimmerHeater(); + } + bloodRecircBlocked = isBloodRecircBlocked(); + dialysateRecircBlocked = isDialysateRecircBlocked(); + } + + return result; +} + +/*********************************************************************//** + * @brief * The publishTreatmentRecircData function publishes recirc progress to UI * at 1 Hz interval. * @details Inputs: recircPublishTimerCtr, recircTimerCtr Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r0244adf04ccc6b154d5c81ecd9b0473584b97509 -rc2415db7dd138b58958d7ae712f31c67bc30b821 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0244adf04ccc6b154d5c81ecd9b0473584b97509) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c2415db7dd138b58958d7ae712f31c67bc30b821) @@ -5451,6 +5451,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingCapacityOverride( payload.state.f32 );