Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r3f53d4aaf8840366306a6143eda9abf1a763bb73 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 3f53d4aaf8840366306a6143eda9abf1a763bb73) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -31,7 +31,7 @@ // ********** private function prototypes ********** -static void setPostTreatStateTransition( TD_POST_TREATMENT_STATE_T state ); +static void setPostTreatStateTransition( void ); static TD_POST_TREATMENT_STATE_T handlePatientDisconnectionState( void ); static TD_POST_TREATMENT_STATE_T handleAutoEjectState( void ); static TD_POST_TREATMENT_STATE_T handleDisposableRemovalState(void ); @@ -40,8 +40,8 @@ /*********************************************************************//** * @brief * The initPostTreatmentMode function initializes the Post-Treatment mode. -* @details Inputs: none -* @details Outputs: Resets all Post-Treatment sub-state variables. +* @details \b Inputs: none +* @details \b Outputs: Resets all Post-Treatment sub-state variables. * @return none **************************************************************************/ void initPostTreatmentMode( void ) @@ -53,16 +53,16 @@ * @brief * The transitionToPostTreatmentMode function prepares the system for * entry into Post-Treatment mode. -* @details Inputs: none -* @details Outputs: Initializes mode specific state and returns the starting +* @details \b Inputs: none +* @details \b Outputs: Initializes mode specific state and returns the starting * Post-Treatment sub-state. * @return Initial Post-Treatment sub-state **************************************************************************/ U32 transitionToPostTreatmentMode( void ) { initPostTreatmentMode(); initTubeSetAutoEject(); - setPostTreatStateTransition( currentPostTreatmentState ); + setPostTreatStateTransition(); return (U32)currentPostTreatmentState; } @@ -71,14 +71,14 @@ * @brief * The setPostTreatStateTransition function sets the actuators and variables * for the state transition in Post-Treatment mode. -* @details Inputs: Valve states, Pump speed -* @details Outputs: Actuate valves, pumps as desired +* @details \b Inputs: Valve states, Pump speed +* @details \b Outputs: Actuate valves, pumps as desired * @Param state Post-Treatment state enum * @return none **************************************************************************/ -static void setPostTreatStateTransition( TD_POST_TREATMENT_STATE_T state ) +static void setPostTreatStateTransition( void ) { - switch( state ) + switch( currentPostTreatmentState ) { case TD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE: //TODO: actuator configuration; @@ -106,8 +106,8 @@ * @brief * The execPostTreatmentMode function executes the Post-Treatment * mode state machine. - * @details Inputs: stop button status and system conditions via helpers. - * @details Outputs: Advances the Post-Treatment sub-state + * @details \b Inputs: stop button status and system conditions via helpers. + * @details \b Outputs: Advances the Post-Treatment sub-state * @return current Post-Treatment sub-state. *************************************************************************/ U32 execPostTreatmentMode( void ) @@ -141,7 +141,7 @@ if ( prevPostTreatmentState != currentPostTreatmentState) { - setPostTreatStateTransition( currentPostTreatmentState ); + setPostTreatStateTransition(); } return (U32)currentPostTreatmentState; @@ -151,8 +151,8 @@ * @brief * The handlePatientDisconnectionState function executes the Post-Treatment * mode Patient Disconnection state machine. - * @details Inputs: TODO fill up if any - * @details Outputs: TODO fill up if any + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any * @return next post-treatment mode state *************************************************************************/ static TD_POST_TREATMENT_STATE_T handlePatientDisconnectionState( void ) @@ -170,8 +170,8 @@ * The handleAutoEjectState function calls Tube Set Auto-Eject Service and * advances to Disposable removal state once the service signals * completion. - * @details Inputs: none - * @details Outputs: Advances Post-Treatment state when eject is complete. + * @details \b Inputs: none + * @details \b Outputs: Advances Post-Treatment state when eject is complete. * @return next Post-Treatment mode state *************************************************************************/ static TD_POST_TREATMENT_STATE_T handleAutoEjectState( void ) @@ -193,8 +193,8 @@ * @brief * The handleDisposableRemovalState function executes the Post-Treatment * mode Disposable Removal state machine. - * @details Inputs: TODO fill up if any - * @details Outputs: TODO fill up if any + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any * @return next post-treatment mode state *************************************************************************/ static TD_POST_TREATMENT_STATE_T handleDisposableRemovalState( void ) @@ -211,8 +211,8 @@ * @brief * The handleVerifyState function executes the Post-Treatment * mode Verify state machine. - * @details Inputs: TODO fill up if any - * @details Outputs: TODO fill up if any + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any * @return next post-treatment mode state *************************************************************************/ static TD_POST_TREATMENT_STATE_T handleVerifyState( void ) Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r6f02ff4686ec9dfc60247e9ed3fc9c5cc7771543 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 6f02ff4686ec9dfc60247e9ed3fc9c5cc7771543) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -19,50 +19,60 @@ #include "ModePreTreat.h" #include "OperationModes.h" #include "Timers.h" +#include "TubeSetInstall.h" #include "TxParams.h" /** * @addtogroup TDPreTreatmentMode * @{ */ -// ********** private definitions ********** - // ********** private data ********** static TD_PRE_TREATMENT_MODE_STATE_T currentPreTreatmentState; ///< Current Pre-Treatment sub-state +static BOOL goToInstallStateRequested; ///< Flag indicating a request to transition to Install state. // ********** private function prototypes ********** +static TD_PRE_TREATMENT_MODE_STATE_T handleWaterSampleState( void ); ///< Handle Water Sample state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestConsumableState( void ); ///< Handle Self Test Consumable state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestNoCartState( void ); ///< Handle Self Test No Cart state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handleInstallState( void ); ///< Handle Install state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestDryState( void ); ///< Handle Self Test Dry state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handlePrimeState( void ); ///< Handle Prime state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handleRecirculateState( void ); ///< Handle Recirculate state during Pre-Treatment static TD_PRE_TREATMENT_MODE_STATE_T handleRxState( void ); ///< Handle Confirm Rx state during Pre-Treatment +static TD_PRE_TREATMENT_MODE_STATE_T handlePatientConnectionState( void ); ///< Handle Patient Connection state during Pre-Treatment /*********************************************************************//** * @brief * The initPreTreatmentMode function initializes the Pre-Treatment mode. -* @details Inputs: none -* @details Outputs: Resets the Treatment Parameters session and sets the initial +* @details \b Inputs: none +* @details \b Outputs: Resets the Treatment Parameters session and sets the initial * Pre-Treatment sub-state. * @return none **************************************************************************/ void initPreTreatmentMode( void ) { // Start a fresh Treatment Parameters session for this run. resetTreatmentParameters(); - currentPreTreatmentState = TD_PRE_TREATMENT_CONFIRM_RX_STATE; + currentPreTreatmentState = TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE; + goToInstallStateRequested = FALSE; } /*********************************************************************//** * @brief * The transitionToPreTreatmentMode function prepares the system for * entry into Pre-Treatment mode. -* @details Inputs: none -* @details Outputs: Initializes mode specific state and returns the starting +* @details \b Inputs: none +* @details \b Outputs: Initializes mode specific state and returns the starting * Pre-Treatment sub-state. * @return Initial Pre-Treatment sub-state **************************************************************************/ U32 transitionToPreTreatmentMode( void ) { initPreTreatmentMode(); + initTubeSetInstall(); return (U32)currentPreTreatmentState; } @@ -71,8 +81,8 @@ * @brief * The execPreTreatmentMode function executes the Pre-Treatment * mode state machine. - * @details Inputs: stop button status and system conditions via helpers. - * @details Outputs: Advances the Pre-Treatment sub-state and + * @details \b Inputs: stop button status and system conditions via helpers. + * @details \b Outputs: Advances the Pre-Treatment sub-state and * previously received user confirmations. * @return current Pre-Treatment sub-state. *************************************************************************/ @@ -100,8 +110,8 @@ // currentPreTreatmentState = handleSelfTestNoCartState(); break; - case TD_PRE_TREATMENT_CART_INSTALL_STATE: - // currentPreTreatmentState = handleInstallState(); + case TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE: + currentPreTreatmentState = handleInstallState(); break; case TD_PRE_TREATMENT_SELF_TEST_DRY_STATE: @@ -135,11 +145,150 @@ /*********************************************************************//** * @brief + * The handleWaterSampleState function executes the Water Sample state of + * pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleWaterSampleState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_WATER_SAMPLE_STATE; + + // TODO: Transition to Self test consumable state on completion when implemented + // state = TD_PRE_TREATMENT_SELF_TEST_CONSUMABLE_STATE; + + return state; +} + +/*********************************************************************//** + * @brief + * The handleSelfTestConsumableState function executes the Self Test + * Consumable state of pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestConsumableState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_SELF_TEST_CONSUMABLE_STATE; + + // TODO: Transition to Self test no cart state on completion when implemented + // state = TD_PRE_TREATMENT_SELF_TEST_NO_CART_STATE; + + return state; +} + +/*********************************************************************//** + * @brief + * The handleSelfTestNoCartState function executes the Self Test No Cart + * state of pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestNoCartState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_SELF_TEST_NO_CART_STATE; + + // TODO: Transition to Tubing set install state on completion when implemented + // state = TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE; + + return state; +} + +/*********************************************************************//** + * @brief + * The handleInstallState function calls Tube Set Install Service and + * advances to Self Test Dry state once the service signals + * completion. + * @details \b Inputs: none + * @details \b Outputs: Advances Pre-Treatment state when install is complete. + * @return next Pre-Treatment mode state + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleInstallState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE; + + // call tube set install service to auto-load tube set + execTubeSetInstall(); + + if ( TRUE == isTubeSetInstallComplete() ) + { + state = TD_PRE_TREATMENT_SELF_TEST_DRY_STATE; + } + + return state; +} + +/*********************************************************************//** + * @brief + * The handleSelfTestDryState function executes the Self Test Dry state + * of pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleSelfTestDryState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_SELF_TEST_DRY_STATE; + + if ( TRUE == goToInstallStateRequested ) + { + goToInstallStateRequested = FALSE; + initTubeSetInstall(); + state = TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE; + } + + // TODO: Transition to Prime state on completion when implemented + // state = TD_PRE_TREATMENT_PRIME_STATE; + + return state; +} + +/*********************************************************************//** + * @brief + * The handlePrimeState function executes the Prime state of + * pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handlePrimeState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_PRIME_STATE; + + // TODO: Transition to Recirculate state on completion when implemented + // state = TD_PRE_TREATMENT_RECIRCULATE_STATE; + + return state; +} + +/*********************************************************************//** + * @brief + * The handleRecirculateState function executes the Recirculate state of + * pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handleRecirculateState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_RECIRCULATE_STATE; + + // TODO: Transition to Confirm RX state on completion when implemented + // state = TD_PRE_TREATMENT_CONFIRM_RX_STATE; + + return state; +} + +/*********************************************************************//** + * @brief * The handleRxState function executes the Confirm Rx pre-treatment step. - * @details Inputs: none - * @details Outputs: Requests transition to Treatment mode when the prescription + * @details \b Inputs: none + * @details \b Outputs: Requests transition to Treatment mode when the prescription * is valid and confirmed otherwise remains in Confirm Rx. - * @return next Pre-Treatment mode sub-state. + * @return next Pre-Treatment mode state. *************************************************************************/ static TD_PRE_TREATMENT_MODE_STATE_T handleRxState( void ) { @@ -150,12 +299,42 @@ // Valid + confirmed – move to next state: Patient Connection if ( ( TRUE == paramsValid ) && ( TRUE == paramsConfirmed ) ) { - // TODO: when additional Pre-Treatment states are implemented, change to TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE. - // state = TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; - requestNewOperationMode( MODE_TREA ); + state = TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; } return state; } +/*********************************************************************//** + * @brief + * The handlePatientConnectionState function executes the Patient + * Connection state of pre-treatment mode. + * @details \b Inputs: TODO fill up if any + * @details \b Outputs: TODO fill up if any + * @return next Pre-Treatment mode state. + *************************************************************************/ +static TD_PRE_TREATMENT_MODE_STATE_T handlePatientConnectionState( void ) +{ + TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; + + // TODO : after implementing this state, place the transition in the right place + + requestNewOperationMode( MODE_TREA ); + + return state; +} + +/*********************************************************************//** + * @brief + * The requestTubeSetInstall function signals a request to transition + * the Pre-Treatment mode state machine to Install state. + * @details \b Inputs: none + * @details \b Outputs: goToInstallStateRequested + * @return none + *************************************************************************/ +void requestTubeSetInstall( void ) +{ + goToInstallStateRequested = TRUE; +} + /**@}*/ Index: firmware/App/Modes/ModePreTreat.h =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -15,7 +15,6 @@ * ***************************************************************************/ - #ifndef __MODE_PRE_TREAT_H__ #define __MODE_PRE_TREAT_H__ @@ -36,6 +35,8 @@ U32 transitionToPreTreatmentMode( void ); // Prepares for transition to pre-treatment mode U32 execPreTreatmentMode( void ); // Execute the pre-treatment mode state machine (call from OperationModes) +void requestTubeSetInstall( void ); // Request Pre-Treatment mode to transition to Install state. + /**@}*/ #endif Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r0a62c26f8c74795bd1a695de879e1a33524481ed -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 0a62c26f8c74795bd1a695de879e1a33524481ed) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -7,8 +7,8 @@ * * @file AlarmMgmtSWFaults.h * -* @author (last) Sameer Kalliadan Poyil -* @date (last) 02-Mar-2026 +* @author (last) Raghu Kallala +* @date (last) 29-Apr-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -182,13 +182,15 @@ SW_FAULT_ID_VALVES_INVALID_VALVE_FINDING_EDGE = 151, SW_FAULT_ID_TD_VALVES_INVALID_FIND_DEENERGIZED_EDGE = 152, SW_FAULT_ID_BLOOD_PRIME_INVALID_STATE = 153, - SW_FAULT_ID_MODE_PRE_TREATMENT_INVALID_STATE = 148, - SW_FAULT_ID_TD_AIR_PUMP_DUTY_CYCLE_OUT_OF_RANGE = 149, - SW_FAULT_ID_MODE_PRE_TX_INSTALL_INVALID_STATE = 150, - SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE = 151, - SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE1 = 152, - SW_FAULT_ID_MODE_POST_TX_AUTO_EJECT_INVALID_STATE = 153, - SW_FAULT_ID_INVALID_MESSAGE_PAYLOAD_LENGTH = 154, + SW_FAULT_ID_MODE_PRE_TREATMENT_INVALID_STATE = 154, + SW_FAULT_ID_TD_AIR_PUMP_DUTY_CYCLE_OUT_OF_RANGE = 155, + SW_FAULT_ID_PI_CTRL_INVALID_CONTROLLER = 156, + SW_FAULT_ID_INVALID_TREATMENT_MODALITY = 157, + SW_FAULT_ID_MODE_PRE_TX_INSTALL_INVALID_STATE = 158, + SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE = 159, + SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE1 = 160, + SW_FAULT_ID_MODE_POST_TX_AUTO_EJECT_INVALID_STATE = 161, + SW_FAULT_ID_INVALID_MESSAGE_PAYLOAD_LENGTH = 162, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/Messaging.c =================================================================== diff -u -re9e339870c5ed01230963f00d400331ab879c91f -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision e9e339870c5ed01230963f00d400331ab879c91f) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -41,6 +41,8 @@ #include "Switches.h" #include "SystemCommTD.h" #include "Temperatures.h" +#include "TubeSetAutoEject.h" +#include "TubeSetInstall.h" #include "TxParams.h" #include "Utilities.h" #include "Valve3Way.h" @@ -114,6 +116,8 @@ { MSG_ID_UI_PRESSURE_LIMIT_WIDEN_REQUEST, &pressureLimitHandleWidenRequest }, { MSG_ID_UI_BLOOD_PRIME_CMD_REQUEST, &bloodPrimeHandleCmdRequest }, { MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST, &bloodPrimeHandleBloodFlowChangeRequest }, + { MSG_ID_UI_ADJUST_DISPOSABLES_CONFIRM_REQUEST, &handleAutoLoadRequest }, + { MSG_ID_UI_ADJUST_DISPOSABLES_REMOVAL_CONFIRM_REQUEST, &handleAutoEjectRequest }, { MSG_ID_TD_SOFTWARE_RESET_REQUEST, &testTDSoftwareResetRequest }, { MSG_ID_TD_BUBBLE_OVERRIDE_REQUEST, &testBubbleDetectOverride }, { MSG_ID_TD_BUBBLE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testBubblesDataPublishIntervalOverride }, Index: firmware/App/Services/StateServices/TubeSetAutoEject.c =================================================================== diff -u -r26b65c70eca7d767f27a5cbbbd67a543ff9b5f26 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Services/StateServices/TubeSetAutoEject.c (.../TubeSetAutoEject.c) (revision 26b65c70eca7d767f27a5cbbbd67a543ff9b5f26) +++ firmware/App/Services/StateServices/TubeSetAutoEject.c (.../TubeSetAutoEject.c) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -55,8 +55,8 @@ /*********************************************************************//** * @brief * The initTubeSetAutoEject function initializes the Tube Set Eject service. -* @details Inputs: none -* @details Outputs: Resets the flags, counters and sets the initial +* @details \b Inputs: none +* @details \b Outputs: Resets the flags, counters and sets the initial * Tube Set Eject sub-state. * @return none **************************************************************************/ @@ -71,8 +71,8 @@ * @brief * The execTubeSetEject function executes the Tube Set Eject * state machine. - * @details Inputs: currentAutoEjectState - * @details Outputs: currentAutoEjectState. Advances the + * @details \b Inputs: currentAutoEjectState + * @details \b Outputs: currentAutoEjectState. Advances the * Tube Set Eject sub-state * @return none *************************************************************************/ @@ -115,8 +115,8 @@ * The handleAutoEjectAwaitConfirmState function handles the Await confirm * state of the Tube Set Eject state machine. * Waits for the user request to auto-eject - * @details Inputs: autoEjectReqReceived - * @details Outputs: autoEjectReqReceived + * @details \b Inputs: autoEjectReqReceived + * @details \b Outputs: autoEjectReqReceived, autoEjectTimerCounter * @return next Auto-Eject state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectAwaitConfirmState( void ) @@ -139,8 +139,8 @@ * The handleAutoEjectHomingState function handles the Homing state * of the Tube Set Eject state machine. * Homes the blood pump (H4) - * @details Inputs: autoEjectTimerCounter, isPeristalticPumpHome() - * @details Outputs: autoEjectTimerCounter + * @details \b Inputs: autoEjectTimerCounter, isPeristalticPumpHome() + * @details \b Outputs: autoEjectTimerCounter * @return next Auto-Eject state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectHomingState( void ) @@ -158,6 +158,10 @@ autoEjectTimerCounter = 0; state = TUBE_SET_AUTO_EJECT_STATE_EXTENDING_EJECTOR; } + else + { + // No action required + } return state; } @@ -167,8 +171,8 @@ * The handleAutoEjectExtendingEjectorState function handles the * Extending Ejector state of the Tube Set Eject Service * state machine. Extends the ejector pin (H5) to engage the tubeset. - * @details Inputs: autoEjectTimerCounter, getEjectorState() - * @details Outputs: autoEjectTimerCounter + * @details \b Inputs: autoEjectTimerCounter, getEjectorState() + * @details \b Outputs: autoEjectTimerCounter * @return next Auto-Eject state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectExtendingEjectorState( void ) @@ -185,6 +189,10 @@ autoEjectTimerCounter = 0; state = TUBE_SET_AUTO_EJECT_STATE_EJECTING; } + else + { + // No action required + } return state; } @@ -195,8 +203,8 @@ * of the Tube Set Eject state machine. Rotates the blood pump (H4) * forward at 100 mL/min with the ejector extended to push the tubeset * out of the rotor. - * @details Inputs: autoEjectTimerCounter, isPeristalticPumpHome() - * @details Outputs: autoEjectTimerCounter + * @details \b Inputs: autoEjectTimerCounter, isPeristalticPumpHome() + * @details \b Outputs: autoEjectTimerCounter * @return next Auto-Eject state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectEjectingState( void ) @@ -215,6 +223,10 @@ autoEjectTimerCounter = 0; state = TUBE_SET_AUTO_EJECT_STATE_RETRACTING_EJECTOR; } + else + { + // No action required + } return state; } @@ -224,8 +236,8 @@ * The handleAutoEjectRetractingEjectorState function handles the * Retracting Ejector state of the Tube Set Eject state * machine. Retracts the ejector pin (H5) after the tubeset has been ejected. - * @details Inputs: autoEjectTimerCounter, getEjectorState() - * @details Outputs: autoEjectTimerCounter + * @details \b Inputs: autoEjectTimerCounter, getEjectorState() + * @details \b Outputs: autoEjectTimerCounter * @return next Auto-Eject state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectRetractingEjectorState( void ) @@ -239,8 +251,12 @@ else if ( EJECTOR_STATE_RETRACTED == getEjectorState() ) { autoEjectTimerCounter = 0; - state = NUM_OF_TUBE_SET_AUTO_EJECT_SUB_STATES; + state = TUBE_SET_AUTO_EJECT_STATE_COMPLETE; } + else + { + // No action required + } return state; } @@ -249,8 +265,8 @@ * @brief * The handleAutoEjectCompleteState function handles the Complete state of * the Tube Set Eject state machine. - * @details Inputs: none - * @details Outputs: none + * @details \b Inputs: none + * @details \b Outputs: none * @return Auto-Eject complete state *************************************************************************/ static TUBE_SET_AUTO_EJECT_STATE_T handleAutoEjectCompleteState( void ) @@ -262,22 +278,27 @@ * @brief * The isTubeSetEjectComplete function reports whether the eject * service has finished successfully. - * @details \b Inputs: none + * @details \b Inputs: currentAutoEjectState * @details \b Outputs: none * @return TRUE if auto-eject completed and ejector is retracted, * FALSE otherwise. *************************************************************************/ BOOL isTubeSetAutoEjectComplete( void ) { - return ( TUBE_SET_INSTALL_STATE_COMPLETE == currentAutoEjectState ? TRUE : FALSE ); + BOOL result = FALSE; + + result = ( TUBE_SET_AUTO_EJECT_STATE_COMPLETE == currentAutoEjectState ? TRUE : FALSE ); + + return result; } /*********************************************************************//** * @brief * The handleAutoEjectRequest function handles a UI request to remove the * disposable tubeset. - * @details Inputs: none - * @details Outputs: autoEjectReqReceived + * @details \b Message \b Sent: MSG_ID_TD_ADJUST_DISPOSABLES_REMOVAL_CONFIRM_RESPONSE + * @details \b Inputs: currentAutoEjectState, getCurrentOperationMode() + * @details \b Outputs: autoEjectReqReceived * @param message UI message which includes the user confirmation to * eject the tubeset * @return TRUE if confirmation/rejection accepted, FALSE if not Index: firmware/App/Services/StateServices/TubeSetAutoEject.h =================================================================== diff -u -r26b65c70eca7d767f27a5cbbbd67a543ff9b5f26 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 26b65c70eca7d767f27a5cbbbd67a543ff9b5f26) +++ firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -32,7 +32,7 @@ // ********** public definitions ********** -// Enumeration of Tube Set Auto-Eject states. +/// Enumeration of Tube Set Auto-Eject states. enum Tube_Set_Auto_Eject_States { TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION = 0, // Waiting for user confirmation to auto-eject @@ -52,7 +52,7 @@ void execTubeSetAutoEject( void ); // Execute the service state machine (call from ModePostTreat and ModeTreatment) BOOL isTubeSetAutoEjectComplete( void ); // Returns True once auto-eject finished successfully -BOOL handleAutoEjectRequest( MESSAGE_T *message); // Handle UI auto-eject confirmation request +BOOL handleAutoEjectRequest( MESSAGE_T *message ); // Handle UI auto-eject confirmation request /**@}*/ Index: firmware/App/Services/StateServices/TubeSetInstall.c =================================================================== diff -u -r26b65c70eca7d767f27a5cbbbd67a543ff9b5f26 -r253979e460b82c6d038e0a566f3be8c6df0a28c9 --- firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 26b65c70eca7d767f27a5cbbbd67a543ff9b5f26) +++ firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 253979e460b82c6d038e0a566f3be8c6df0a28c9) @@ -60,8 +60,8 @@ /*********************************************************************//** * @brief * The initTubeSetInstall function initializes the Tube Set Install service. -* @details Inputs: none -* @details Outputs: Resets the flags, counters and sets the initial +* @details \b Inputs: none +* @details \b Outputs: Resets the flags, counters and sets the initial * Tube Set Install sub-state. * @return none **************************************************************************/ @@ -76,8 +76,8 @@ * @brief * The execTubeSetInstall function executes the Tube Set Install * state machine. - * @details Inputs: currentInstallState - * @details Outputs: currentInstallState. Advances the + * @details \b Inputs: currentInstallState + * @details \b Outputs: currentInstallState. Advances the * Tube Set Install sub-state * @return none *************************************************************************/ @@ -116,8 +116,8 @@ * The handleAwaitTubesetConfirmationState function handles the Await * tubeset confirmation state of Tubing Set install state machine. * Should wait for the user to confirm the tubeset is placed - * @details Inputs: confirmTubsetPlaced - * @details Outputs: confirmTubesetPlaced + * @details \b Inputs: confirmTubsetPlaced + * @details \b Outputs: confirmTubesetPlaced * return next Install sub-state *************************************************************************/ static TUBE_SET_INSTALL_STATE_T handleAwaitTubesetConfirmationState( void ) @@ -140,8 +140,8 @@ * The handleAwaitBPDoorCloseState function handles the Await Blood Pump * Door Close state of Tubing Set install state machine. * Should wait until blood pump door (H9) is closed. - * @details Inputs: H9_SWCH state - * @details Outputs: none + * @details \b Inputs: H9_SWCH state + * @details \b Outputs: none * return next Install sub-state *************************************************************************/ static TUBE_SET_INSTALL_STATE_T handleAwaitBPDoorCloseState( void ) @@ -161,9 +161,9 @@ * @brief * The handleAutoLoadState function handles the Auto-Load state of * Tube Set install state. - * @details Inputs: bloodPumpTimerCounter, getMeasuredBloodPumpTorque() + * @details \b Inputs: bloodPumpTimerCounter, getMeasuredBloodPumpTorque() * isPeristalticPumpHome() - * @details Outputs: bloodPumpTimerCounter + * @details \b Outputs: bloodPumpTimerCounter * return next Install sub-state *************************************************************************/ static TUBE_SET_INSTALL_STATE_T handleAutoLoadState( void ) @@ -177,6 +177,7 @@ signalBloodPumpHardStop(); SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_AUTO_LOAD_EJECT_BP_TIMEOUT, isPeristalticPumpHome(), bloodPumpTimerCounter ); } + // Torque jam check. If measured torque exceeds the limit, the tubing set is likely jammed in the rotor. else if ( bpTorque > INSTALL_AUTO_LOAD_TORQUE_LIMIT_MNM ) { signalBloodPumpHardStop(); @@ -185,12 +186,17 @@ bloodPumpTimerCounter = 0; state = TUBE_SET_INSTALL_STATE_AUTO_LOAD_BACK_OFF; } + // BP home position check else if ( TRUE == isPeristalticPumpHome() ) { signalBloodPumpHardStop(); bloodPumpTimerCounter = 0; state = TUBE_SET_INSTALL_STATE_COMPLETE; } + else + { + // No action required + } return state; } @@ -199,8 +205,8 @@ * @brief * The handleAutoLoadBackOffState function handles the Auto-Load Back-Off * state of Tube Set install state. - * @details Inputs: bloodPumpTimerCounter, isPeristalticPumpHome() - * @details Outputs: bloodPumpTimerCounter + * @details \b Inputs: bloodPumpTimerCounter, isPeristalticPumpHome() + * @details \b Outputs: bloodPumpTimerCounter * return next Install sub-state *************************************************************************/ static TUBE_SET_INSTALL_STATE_T handleAutoLoadBackOffState( void ) @@ -223,6 +229,10 @@ state = TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION; } } + else + { + // No action required + } return state; } @@ -231,8 +241,8 @@ * @brief * The handleInstallCompleteState function handles the Install Complete * state of Tube Set install state. - * @details Inputs: none - * @details Outputs: none + * @details \b Inputs: none + * @details \b Outputs: none * return install complete state *************************************************************************/ static TUBE_SET_INSTALL_STATE_T handleInstallCompleteState( void ) @@ -250,15 +260,20 @@ *************************************************************************/ BOOL isTubeSetInstallComplete( void ) { - return ( TUBE_SET_INSTALL_STATE_COMPLETE == currentInstallState ? TRUE : FALSE ); + BOOL result; + + result = ( TUBE_SET_INSTALL_STATE_COMPLETE == currentInstallState ? TRUE : FALSE ); + + return result; } /*********************************************************************//** * @brief * The handleAutoLoadRequest function handles a UI request to * confirm tubeset installation. - * @details Inputs: none - * @details Outputs: confirmTubesetPlaced + * @details \b Message \b Sent: MSG_ID_TD_ADJUST_DISPOSABLES_CONFIRM_RESPONSE + * @details \b Inputs: none + * @details \b Outputs: confirmTubesetPlaced * @param message UI message which includes the user confirmation of * tubset installation. * @return TRUE if confirmation/rejection accepted, FALSE if not