Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r113f60c96d311d25658fe7a3895adf5c3734d16f -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 113f60c96d311d25658fe7a3895adf5c3734d16f) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -7,8 +7,8 @@ * * @file ModePreTreat.c * -* @author (last) Praneeth Bunne -* @date (last) 04-Jun-2026 +* @author (last) Vijay Pamula +* @date (last) 12-Jun-2026 * * @author (original) Dara Navaei * @date (original) 25-Sep-2025 @@ -21,7 +21,11 @@ #include "DDInterface.h" #include "ModePreTreat.h" #include "OperationModes.h" +<<<<<<< HEAD #include "TaskGeneral.h" +======= +#include "StatePreTxRecirculate.h" +>>>>>>> 0904e146ed12daa575b419612f5cdef5000fd0f5 #include "Timers.h" #include "TubeSetInstall.h" #include "TxParams.h" @@ -40,9 +44,13 @@ 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. +<<<<<<< HEAD static BOOL alarmActionResumeReceived; ///< Flag indicates alarm action resume received. static BOOL tubeSetInstallRequested; ///< Request to re-enter install flow (mid-treatment / failure) static U32 submodeCompleteTransitionTimeCounter; ///< Sub-mode completed transition wait time counter. +======= +static BOOL continueFromRecirculateRequested; ///< Flag indicating a request to transition to Patient Connection state. +>>>>>>> 0904e146ed12daa575b419612f5cdef5000fd0f5 // ********** private function prototypes ********** @@ -70,6 +78,7 @@ initTreatmentParameters(); currentPreTreatmentState = TD_PRE_TREATMENT_TUBING_SET_INSTALL_STATE; goToInstallStateRequested = FALSE; + continueFromRecirculateRequested = FALSE; } /*********************************************************************//** @@ -141,14 +150,14 @@ currentPreTreatmentState = handlePrimeState(); break; - case TD_PRE_TREATMENT_RECIRCULATE_STATE: - currentPreTreatmentState = handleRecirculateState(); - break; - case TD_PRE_TREATMENT_CONFIRM_RX_STATE: currentPreTreatmentState = handleRxState(); break; + case TD_PRE_TREATMENT_RECIRCULATE_STATE: + currentPreTreatmentState = handleRecirculateState(); + break; + case TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE: currentPreTreatmentState = handlePatientConnectionState(); break; @@ -312,25 +321,35 @@ * @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 + * @details \b Inputs: continueFromRecirculateRequested. + * @details \b Outputs: continueFromRecirculateRequested. * @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; + execPreTxRecirculate(); + if ( TRUE == continueFromRecirculateRequested ) + { + continueFromRecirculateRequested = FALSE; + + // TODO: Change to TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE + // when Patient Connection state is implemented. + // state = TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; + + requestNewOperationMode( MODE_TREA ); + } + return state; } /*********************************************************************//** * @brief * The handleRxState function executes the Confirm Rx pre-treatment step. * @details \b Inputs: none - * @details \b Outputs: Requests transition to Treatment mode when the prescription + * @details \b Outputs: Requests transition to the next Pre-Treatment state when the prescription * is valid and confirmed otherwise remains in Confirm Rx. * @return next Pre-Treatment mode state. *************************************************************************/ @@ -346,7 +365,7 @@ TD_PRE_TREATMENT_MODE_STATE_T state = TD_PRE_TREATMENT_CONFIRM_RX_STATE; DD_OP_MODE_T ddOpMode = getDDOpMode(); - // Valid + confirmed – move to next state: Patient Connection + // Valid + confirmed – move to next state: Recirculate State if ( ( TRUE == paramsValid ) && ( TRUE == paramsConfirmed ) ) { // TODO this command of requesting dialysate delivery will move to appropriate state in pre-treatment once implemented @@ -362,15 +381,11 @@ getTreatmentParameterU32( TREATMENT_PARAM_SODIUM ), getTreatmentParameterU32( TREATMENT_PARAM_BICARBONATE ) ); } - // TODO: when additional Pre-Treatment states are implemented, change to TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE. - // state = TD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; - if ( ( ddOpMode == DD_MODE_GEND ) && ( TRUE == isDialysateGoodToDeliver ) ) - { - requestNewOperationMode( MODE_TREA ); - } - } - return state; + state = TD_PRE_TREATMENT_RECIRCULATE_STATE; + } + + return state; } /*********************************************************************//** @@ -407,9 +422,22 @@ /*********************************************************************//** * @brief + * The PreTxRequestContinueFromRecirculate function signals a request to + * transition the Pre-Treatment mode state machine to Patient Connection state. + * @details \b Inputs: none + * @details \b Outputs: continueFromRecirculateRequested + * @return none + *************************************************************************/ +void PreTxRequestContinueFromRecirculate( void ) +{ + continueFromRecirculateRequested = TRUE; +} + +/*********************************************************************//** + * @brief * The signalAlarmActionToPreTreatmentMode function executes the given alarm action * as appropriate while in Pre-Treatment Mode. - * @details \b Inputs: none + * @details \b Inputs: currentPreTreatmentState * @details \b Outputs: given alarm action executed * @param action ID of alarm action to execute * @return none @@ -422,6 +450,13 @@ // TODO add logic once we have pre-treatment mode developed break; + case ALARM_ACTION_RESUME: + if ( TD_PRE_TREATMENT_RECIRCULATE_STATE == currentPreTreatmentState ) + { + signalResumePreTxRecirculate(); + } + break; + default: // do not handle other actions in pre-treatment mode break; Index: firmware/App/Modes/ModePreTreat.h =================================================================== diff -u -r21a1f9847f1ccf22ec8b906bcdadea47ec7b5dc9 -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 21a1f9847f1ccf22ec8b906bcdadea47ec7b5dc9) +++ firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -7,8 +7,8 @@ * * @file ModePreTreat.h * -* @author (last) Praneeth Bunne -* @date (last) 19-May-2026 +* @author (last) Vijay Pamula +* @date (last) 12-Jun-2026 * * @author (original) Dara Navaei * @date (original) 25-Sep-2025 @@ -39,6 +39,7 @@ TD_PRE_TREATMENT_MODE_STATE_T getPreTreatmentSubState( void ); // Get the current pre-treatment sub mode. void PreTxRequestTubeSetInstall( void ); // Request Pre-Treatment mode to transition to Install state. +void PreTxRequestContinueFromRecirculate( void ); // Request Pre-Treatment mode to transition to Patient Connection state. /**@}*/ Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r113f60c96d311d25658fe7a3895adf5c3734d16f -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 113f60c96d311d25658fe7a3895adf5c3734d16f) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -7,8 +7,8 @@ * * @file AlarmMgmtSWFaults.h * -* @author (last) Praneeth Bunne -* @date (last) 04-Jun-2026 +* @author (last) Vijay Pamula +* @date (last) 12-Jun-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -196,8 +196,9 @@ SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE1 = 165, SW_FAULT_ID_MODE_POST_TX_AUTO_EJECT_INVALID_STATE = 166, SW_FAULT_ID_INVALID_FLUID_BOLUS_STATE = 167, - SW_FAULT_ID_INVALID_MESSAGE_PAYLOAD_LENGTH = 168, - SW_FAULT_ID_TD_INVALID_DRY_SELF_TEST_STATE = 169, + SW_FAULT_ID_PRE_TX_RECIRC_INVALID_STATE = 168, + SW_FAULT_ID_INVALID_MESSAGE_PAYLOAD_LENGTH = 169, + SW_FAULT_ID_TD_INVALID_DRY_SELF_TEST_STATE = 170, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r9e38d223e94cf990a87fa8615acf9a8c5c585852 -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 9e38d223e94cf990a87fa8615acf9a8c5c585852) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -7,8 +7,8 @@ * * @file DDInterface.c * -* @author (last) Praneeth Bunne -* @date (last) 27-May-2026 +* @author (last) Varshini Nagabooshanam +* @date (last) 15-Jun-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -rbfb859737f3d221f08c0f43d1bd4ba7b7680911f -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision bfb859737f3d221f08c0f43d1bd4ba7b7680911f) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -8,7 +8,7 @@ * @file FpgaTD.c * * @author (last) Varshini Nagabooshanam -* @date (last) 22-May-2026 +* @date (last) 15-Jun-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -1295,18 +1295,6 @@ /*********************************************************************//** * @brief - * The getAirPumpRPM function reads the air pump RPM from FPGA. - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return air pump RPM value - *************************************************************************/ -U16 getAirPumpRPM( void ) -{ - return fpgaSensorReadings.h12Speed; -} - -/*********************************************************************//** - * @brief * The checkFPGACommFailure function increments the FPGA comm failure * windowed timer and returns whether or not the number of failures in * the window have been reached. Index: firmware/App/TDCommon.h =================================================================== diff -u -rc34e7ec999eee096c1b596d4f7ac0986da8c8760 -r927dfd6e109af46160e5aef687f1b7c286d24703 --- firmware/App/TDCommon.h (.../TDCommon.h) (revision c34e7ec999eee096c1b596d4f7ac0986da8c8760) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision 927dfd6e109af46160e5aef687f1b7c286d24703) @@ -25,7 +25,7 @@ #define TD_VERSION_MAJOR 0 #define TD_VERSION_MINOR 0 #define TD_VERSION_MICRO 0 -#define TD_VERSION_BUILD 53 +#define TD_VERSION_BUILD 55 // ********** development build switches **********