Index: firmware/App/Services/StateServices/TubeSetInstall.c =================================================================== diff -u -r069dee3a2428d3c6bb281db1844a372ae6e2063a -re4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67 --- firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 069dee3a2428d3c6bb281db1844a372ae6e2063a) +++ firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision e4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67) @@ -8,7 +8,7 @@ * @file TubeSetInstall.c * * @author (last) Praneeth Bunne -* @date (last) 26-Jun-2026 +* @date (last) 04-Jun-2026 * * @author (original) Praneeth Bunne * @date (original) 01-May-2026 @@ -17,7 +17,6 @@ #include "AlarmMgmtTD.h" #include "BloodFlow.h" -#include "DDInterface.h" #include "Messaging.h" #include "OperationModes.h" #include "PeristalticPump.h" @@ -26,7 +25,6 @@ #include "TDDefs.h" #include "Timers.h" #include "TubeSetInstall.h" -#include "TxParams.h" /** * @addtogroup TubeSetInstall @@ -44,24 +42,20 @@ // ********** private data ********** static BOOL confirmTubesetPlaced; ///< Flag indicating user has confirmed tubeset is placed -static BOOL setupConnectionsConfirmed; ///< Flag indicating user has confirmed setup connections are complete. static U32 bloodPumpTimerCounter; ///< Blood Pump timer counter static BOOL bpLastHome; ///< Flag for blood pump last home (for rising-edge) static U32 bpLeftHomeTimerCounter; ///< Timer counter to measure how long BP has been away from home static TUBE_SET_INSTALL_STATE_T previousInstallState; ///< Previous tube set install sub-state static TUBE_SET_INSTALL_STATE_T currentInstallState; ///< Current tubing set install sub-state -static TUBE_SET_TYPE_T currentTubeSetType; ///< Current installed tube set type - // ********** private function prototypes ********** -static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ); ///< Handle Await Tubset Install Confirmation sub-state -static TUBE_SET_INSTALL_STATE_T handleAwaitBPDoorCloseState( void ); ///< Handle Await Blood Pump Door Close sub-state. -static TUBE_SET_INSTALL_STATE_T handleAutoLoadState( void ); ///< Handle Auto-Load sub-state -static TUBE_SET_INSTALL_STATE_T handleAwaitSetupConnectionConfirmationState( void ); ///< Handle Await Setup Connection Confirmation sub-state -static TUBE_SET_INSTALL_STATE_T handleAutoLoadBackOffState( void ); ///< Handle Auto-Load Back-off sub-state -static TUBE_SET_INSTALL_STATE_T handleInstallCompleteState( void ); ///< Handle Install complete state +static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ); ///< Handle Await Tubset Install Confirmation sub-state +static TUBE_SET_INSTALL_STATE_T handleAwaitBPDoorCloseState( void ); ///< Handle Await Blood Pump Door Close sub-state. +static TUBE_SET_INSTALL_STATE_T handleAutoLoadState( void ); ///< Handle Auto-Load sub-state +static TUBE_SET_INSTALL_STATE_T handleAutoLoadBackOffState( void ); ///< Handle Auto-Load Back-off sub-state +static TUBE_SET_INSTALL_STATE_T handleInstallCompleteState( void ); ///< Handle Install complete state /*********************************************************************//** * @brief @@ -73,14 +67,12 @@ **************************************************************************/ void initTubeSetInstall( void ) { - previousInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; - currentInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; - confirmTubesetPlaced = FALSE; - setupConnectionsConfirmed = FALSE; - bloodPumpTimerCounter = 0; - bpLastHome = TRUE; - bpLeftHomeTimerCounter = 0; - currentTubeSetType = TUBE_SET_TYPE_UNKNOWN; + previousInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; + currentInstallState = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; + confirmTubesetPlaced = FALSE; + bloodPumpTimerCounter = 0; + bpLastHome = TRUE; + bpLeftHomeTimerCounter = 0; } /*********************************************************************//** @@ -112,10 +104,6 @@ currentInstallState = handleAutoLoadBackOffState(); break; - case TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION: - currentInstallState = handleAwaitSetupConnectionConfirmationState(); - break; - case TUBE_SET_INSTALL_STATE_COMPLETE: currentInstallState = handleInstallCompleteState(); break; @@ -127,8 +115,8 @@ if ( previousInstallState != currentInstallState ) { - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, previousInstallState, currentInstallState ); previousInstallState = currentInstallState; + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_SUB_STATE_CHANGE, previousInstallState, currentInstallState ); } } @@ -144,24 +132,11 @@ static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ) { TUBE_SET_INSTALL_STATE_T state = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; - F32 bicarbConvFactor = BICARBONATE_CONVERSION_FACTOR; if ( TRUE == confirmTubesetPlaced ) { // Door closed required from Auto-loading onwards, set to false if not required in subsequent states doorClosedRequired( TRUE ); - - // Request DD to generate dialysate with Qd = 600 mL/min, - // Quf = 0, and dialyzer bypassed. - cmdStartGenerateDialysate( 600.0F, - 0.0F, - getTreatmentParameterF32( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ), - TRUE, - getTreatmentParameterF32( TREATMENT_PARAM_ACID_CONCENTRATE_CONV_FACTOR ), - bicarbConvFactor, - getTreatmentParameterU32( TREATMENT_PARAM_SODIUM ), - getTreatmentParameterU32( TREATMENT_PARAM_BICARBONATE ) ); - confirmTubesetPlaced = FALSE; state = TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE; } @@ -229,7 +204,7 @@ signalBloodPumpHardStop(); bloodPumpTimerCounter = 0; bpLeftHomeTimerCounter = 0; - state = TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION; + state = TUBE_SET_INSTALL_STATE_COMPLETE; } else { @@ -248,28 +223,6 @@ /*********************************************************************//** * @brief - * The handleAwaitSetupConnectionConfirmationState function handles the - * Await Setup Connection Confirmation state of Tube Set install state. - * @details \b Inputs: setupConnectionsConfirmed - * @details \b Outputs: setupConnectionsConfirmed - * @return next Install sub-state - *************************************************************************/ -static TUBE_SET_INSTALL_STATE_T handleAwaitSetupConnectionConfirmationState( void ) -{ - TUBE_SET_INSTALL_STATE_T state = TUBE_SET_INSTALL_STATE_AWAIT_SETUP_CONNECTION_CONFIRMATION; - - if ( TRUE == setupConnectionsConfirmed ) - { - setupConnectionsConfirmed = FALSE; - - state = TUBE_SET_INSTALL_STATE_COMPLETE; - } - - return state; -} - -/*********************************************************************//** - * @brief * The handleAutoLoadBackOffState function handles the Auto-Load Back-Off * state of Tube Set install state. * @details \b Inputs: bloodPumpTimerCounter @@ -379,113 +332,4 @@ return result; } -/*********************************************************************//** - * @brief - * The handleSetupTubingSetConnectionConfirmRequest function handles a UI request - * to confirm setup connections are complete. - * @details \b Message \b Sent: MSG_ID_TD_SETUP_TUBING_SET_CONNECTIONS_CONFIRM_RESPONSE - * @details \b Inputs: none - * @details \b Outputs: setupConnectionsConfirmed - * @param message UI message which includes the user confirmation of - * setup connections completion. - * @return TRUE if confirmation accepted, FALSE otherwise. - *************************************************************************/ -BOOL handleSetupTubingSetConnectionConfirmRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - UI_RESPONSE_PAYLOAD_T response; - - response.rejectionReason = REQUEST_REJECT_REASON_NONE; - - if ( 0 == message->hdr.payloadLen ) - { - if ( TUBE_SET_INSTALL_STATE_COMPLETE != currentInstallState ) - { - setupConnectionsConfirmed = TRUE; - result = TRUE; - } - else - { - response.rejectionReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; - } - } - else - { - response.rejectionReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; - } - - response.accepted = result; - - sendMessage( MSG_ID_TD_SETUP_TUBING_SET_CONNECTIONS_CONFIRM_RESPONSE, COMM_BUFFER_OUT_CAN_TD_2_UI, (U08*)&response, sizeof( UI_RESPONSE_PAYLOAD_T ) ); - - return result; -} - -/*********************************************************************//** -* The setTubeSetType function sets the current installed tube set type. - * @details \b Alarms: ALARM_ID_TD_SOFTWARE_FAULT if tube set is invalid type - * @details \b Inputs: none - * @details \b Outputs: currentTubeSetType - * @param type Tube set type determined from barcode scan. - * @return none - *************************************************************************/ -void setTubeSetType( TUBE_SET_TYPE_T type ) -{ - if ( type < NUM_OF_TUBE_SET_TYPES ) - { - currentTubeSetType = type; - } - else - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_TUBE_SET_TYPE, (U32)type ); - } -} - -/*********************************************************************//** - * @brief - * The getTubeSetType function returns the current installed tube set type. - * @details \b Inputs: currentTubeSetType - * @details \b Outputs: none - * @return Current installed tube set type. - *************************************************************************/ -TUBE_SET_TYPE_T getTubeSetType( void ) -{ - return currentTubeSetType; -} - -/*********************************************************************//** - * @brief - * The validateTubeSetType function validates the current installed tube set type - * based on modality. - * @details \b Alarm: - * @details \b Inputs: none - * @details \b Outputs: none - * @return none. - *************************************************************************/ -void validateTubeSetType( void ) -{ - U32 modality = getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_MODALITY ); - BOOL misMatch = FALSE; - - if ( TREATMENT_MODALITY_HDF_ONLINE_FLUID == modality ) - { - if ( TUBE_SET_TYPE_HDF != currentTubeSetType ) - { - misMatch = TRUE; - } - } - else - { - if ( TREATMENT_MODALITY_HD_SALINE_FLUID != currentTubeSetType ) - { - misMatch = TRUE; - } - } - - if ( TRUE == misMatch ) - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_TUBE_SET_MISMATCH, modality, (U32)currentTubeSetType ); - } -} - /**@}*/