Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r0eb08506bbe69f0cfc272e0a329591ffdeb3fc95 -r7166df604166f74ff5eb8667e07947d52ac39cf2 --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 0eb08506bbe69f0cfc272e0a329591ffdeb3fc95) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 7166df604166f74ff5eb8667e07947d52ac39cf2) @@ -8,7 +8,7 @@ * @file StateTxPaused.c * * @author (last) Praneeth Bunne -* @date (last) 26-Jun-2026 +* @date (last) 07-Aug-2026 * * @author (original) Sean Nash * @date (original) 21-Apr-2025 @@ -105,15 +105,8 @@ setCurrent4thLevelState( NO_SUB_STATE ); // Set user alarm recovery actions allowed in this sub-mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); - if ( FALSE ) // TODO ( TRUE == getRinsebackCompleted() ) - { - // block rinseback action if already done - setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); - } - else - { - setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); - } + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_TEMPORARY_BREAK, TRUE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); transitionToTxPausedState( currentTxPausedState ); @@ -366,34 +359,27 @@ * The handleTreatmentPausedBloodSittingTimer function handles the no re-circ * blood timer. It should only be called when Blood is NOT circulating. * Increments and checks for warning and alarm timeouts. - * @details Inputs: bloodSittingTimerCtr - * @details Outputs: bloodSittingTimerCtr - * @return next treatment paused state + * @details \b Inputs: bloodSittingTimerCtr + * @details \b Outputs: bloodSittingTimerCtr + * @return none *************************************************************************/ static void handleTreatmentPausedBloodSittingTimer( void ) { // Ensure we do not sit in stopped state for too long (if blood in line) - //if ( getRinsebackCompleted() != TRUE ) // TODO rinseback - if ( TRUE ) + bloodSittingTimerCtr++; + + if ( FALSE == doesAlarmStatusIndicateEndTxOnly() ) // Alarms appropriate only if we are not already at an alarm stop, end Tx only { - bloodSittingTimerCtr++; - if ( FALSE == doesAlarmStatusIndicateEndTxOnly() ) // Alarms appropriate only if we are not already at an alarm stop, end Tx only + if ( bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) { - if ( bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) - { - activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_WARNING ); - } - if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) - { - // Activate the alarm - activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_TOO_LONG ); - } + activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_WARNING ); } + if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) + { + // Activate the alarm + activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_TOO_LONG ); + } } - else - { - bloodSittingTimerCtr = 0; - } } /*********************************************************************//** Index: firmware/App/Monitors/Pressures.c =================================================================== diff -u -r384157184f801e501c61bdf675d7d8b727b5ab9d -r7166df604166f74ff5eb8667e07947d52ac39cf2 --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 384157184f801e501c61bdf675d7d8b727b5ab9d) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 7166df604166f74ff5eb8667e07947d52ac39cf2) @@ -7,8 +7,8 @@ * * @file Pressures.c * -* @author (last) Varshini Nagabooshanam -* @date (last) 03-Aug-2026 +* @author (last) Praneeth Bunne +* @date (last) 04-Aug-2026 * * @author (original) Sean Nash * @date (original) 24-Sep-2024 @@ -88,7 +88,7 @@ #define MAX_ART_VEN_OFFSET_MMHG 15.0F ///< Maximum arterial/venous offset allowed. -#define EMPTY_SALINE_BAG_THRESHOLD_MMHG -300.0F ///< Threshold below which the saline bag is considered empty (in mmHg). +#define EMPTY_SALINE_BAG_THRESHOLD_MMHG -40.0F ///< Threshold below which the saline bag is considered empty (in mmHg). static const U32 EMPTY_SALINE_BAG_PERSISTENCE = ( 250 / TASK_GENERAL_INTERVAL ); ///< Time that saline bag looks empty before saying it is empty. #define PRES_ALARM_PERSISTENCE ( 1 * MS_PER_SECOND ) ///< Alarm persistence period for pressure alarms. Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r1c21d74bc369572b0fcc5b978adc23dc9ce7c656 -r7166df604166f74ff5eb8667e07947d52ac39cf2 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 1c21d74bc369572b0fcc5b978adc23dc9ce7c656) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 7166df604166f74ff5eb8667e07947d52ac39cf2) @@ -7,8 +7,8 @@ * * @file Messaging.c * -* @author (last) Varshini Nagabooshanam -* @date (last) 07-Aug-2026 +* @author (last) Praneeth Bunne +* @date (last) 10-Aug-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -42,6 +42,8 @@ #include "StateTxBloodPrime.h" #include "StateTxDialysis.h" #include "StateTxPaused.h" +#include "StateTxRecirc.h" +#include "StateTxRinseback.h" #include "Switches.h" #include "SyringePump.h" #include "SystemCommTD.h" @@ -141,7 +143,9 @@ { MSG_ID_UI_BLOOD_PRESSURE_REQUEST, &bpModuleHandleVitalsRequest }, { MSG_ID_FFU_SIGNAL_TD_UPDATE_AVAILABLE, &handleUpdateAvailable }, { MSG_ID_UI_FLUID_BOLUS_REQUEST, &handleFluidBolusRequest }, - { MSG_ID_UI_GENERIC_CONFIRMATION_RESULT_RESPONSE, &handleUIConfirmationResponse }, + { MSG_ID_UI_RINSEBACK_CMD_REQUEST, &signalRinsebackUserAction }, + { MSG_ID_UI_RECIRCULATE_REQUEST, &signalTreatmentRecircUserAction }, + { MSG_ID_UI_GENERIC_CONFIRMATION_RESULT_RESPONSE, &handleUIConfirmation }, { MSG_ID_TD_SOFTWARE_RESET_REQUEST, &testTDSoftwareResetRequest }, { MSG_ID_TD_BUBBLE_OVERRIDE_REQUEST, &testBubbleDetectOverride }, { MSG_ID_TD_BUBBLE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testBubblesDataPublishIntervalOverride }, @@ -151,6 +155,7 @@ { MSG_ID_TD_PRESSURE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPressuresDataPublishIntervalOverride }, { MSG_ID_TD_AIR_PUMP_SET_STATE_REQUEST, &testSetAirPump }, { MSG_ID_TD_AIR_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testAirPumpDataPublishIntervalOverride }, + { MSG_ID_TD_AIR_PUMP_RPM_OVERRIDE_REQUEST, &testAirPumpRPMOverride }, { MSG_ID_TD_SWITCHES_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testSwitchesDataPublishIntervalOverride }, { MSG_ID_TD_SWITCH_STATE_OVERRIDE_REQUEST, &testSwitchOverride }, { MSG_ID_TD_OFF_BUTTON_OVERRIDE_REQUEST, &testOffButtonOverride }, @@ -225,6 +230,8 @@ { MSG_ID_TD_HEPARIN_BOLUS_TARGET_RATE_OVERRIDE_REQUEST, &testHeparinBolusTargetRateOverride }, { MSG_ID_TD_SYRINGE_PUMP_FORCE_SENSOR_CALIBRATION_REQUEST, &testCalibrateForceSensor }, { MSG_ID_TD_GET_ALARM_PROPERTIES_REQUEST, &testGetAlarmPropertiesRequest }, + { MSG_ID_TD_RINSEBACK_VOLUME_OVERRIDE, &testRinsebackVolumeOverride }, + { MSG_ID_TD_RINSEBACK_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testRinsebackPublishIntervalOverride }, }; /// Number of entries in the message handling function lookup table. @@ -555,6 +562,54 @@ return result; } +/*********************************************************************//** + * The sendPOSTFinalResult function sends the overall TD POST result + * and queues the message for transmit on the appropriate CAN channel. + * @details \b Message \b Sent: MSG_ID_TD_POST_FINAL_TEST_RESULT + * @details \b Inputs: none + * @details \b Outputs: TD POST final result msg queued for CAN transmit. + * @param passed TRUE if all TD POST tests passed, FALSE otherwise. + * @return TRUE if message successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPOSTFinalResult( BOOL passed ) +{ + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_FINAL_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08 *)&passed, sizeof( BOOL ) ); +} + +/*********************************************************************//** + * @brief + * The handleUIConfirmationResponse function handles a UI response for a + * confirmation request. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message pointer to the received confirmation response message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleUIConfirmation( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( ( 2U * sizeof(U32) ) == message->hdr.payloadLen ) + { + U32 requestID; + U32 status; + + memcpy( &requestID, message->payload, sizeof(U32) ); + memcpy( &status, message->payload + sizeof(U32), sizeof(U32) ); + + if ( ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) || + ( CONFIRMATION_REQUEST_STATUS_REJECTED == ( CONFIRMATION_REQUEST_STATUS_T)status ) ) + { + setConfirmationRequestStatus( ( GENERIC_CONFIRM_ID_T )requestID, + ( CONFIRMATION_REQUEST_STATUS_T)status ); + result = TRUE; + } + } + + return result; +} + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -646,7 +701,61 @@ return result; } +/*********************************************************************//** + * The sendPOSTTestResult function sends the result of a single TD POST + * test to the UI. + * @details \b Message \b Sent: MSG_ID_TD_POST_SINGLE_TEST_RESULT + * @details \b Inputs: none + * @details \b Outputs: TD POST test result msg queued for CAN transmit. + * @param test ID of the TD POST test. + * @param passed TRUE if POST test passed, FALSE if POST test failed. + * @return TRUE if message successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ) +{ + U08 payload[ sizeof( BOOL ) + sizeof( U32 ) ]; + U32 testID = (U32)test; + memcpy( payload, &passed, sizeof( BOOL ) ); + memcpy( &payload[ sizeof( BOOL ) ], &testID, sizeof( U32 ) ); + + // Use the generic send helper for transmission. + return sendMessage( MSG_ID_TD_POST_SINGLE_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, payload, sizeof( payload ) ); +} + +/*********************************************************************//** + * @brief + * The sendConfirmationRequest function constructs and transmits a + * confirmation request message to the UI. + * @details \b Message \b Sent: MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST + * @details \b Inputs: none + * @details \b Outputs: none + * @param requestID ID of the confirmation being requested + * @param requestType Type of confirmation being requested + * @param rejectReason Reason for reject if type is reject, 0 otherwise + * @return none + *************************************************************************/ +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, + GENERIC_CONFIRM_COMMAND_T requestType, + U32 rejectReason ) +{ + GENERIC_CONFIRMATION_REQUEST_T payload; + + payload.requestID = (U32)requestID; + payload.requestType = (U32)requestType; + payload.rejectReason = rejectReason; + payload.genericPayload1 = 0.0F; + payload.genericPayload2 = 0.0F; + payload.genericPayload3 = 0.0F; + payload.genericPayload4 = 0.0F; + + sendMessage( MSG_ID_TD_UI_GENERIC_CONFIRMATION_REQUEST, + COMM_BUFFER_OUT_CAN_TD_2_UI, + (U08*)&payload, + sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -786,45 +895,6 @@ /*********************************************************************//** * @brief - * The sendPOSTTestResult function sends the result of a single TD POST - * test to the UI. - * @details \b Message \b Sent: MSG_ID_TD_POST_SINGLE_TEST_RESULT - * @details \b Inputs: none - * @details \b Outputs: TD POST test result msg queued for CAN transmit. - * @param test ID of the TD POST test. - * @param passed TRUE if POST test passed, FALSE if POST test failed. - * @return TRUE if message successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ) -{ - U08 payload[ sizeof( BOOL ) + sizeof( U32 ) ]; - U32 testID = (U32)test; - - memcpy( payload, &passed, sizeof( BOOL ) ); - memcpy( &payload[ sizeof( BOOL ) ], &testID, sizeof( U32 ) ); - - // Use the generic send helper for transmission. - return sendMessage( MSG_ID_TD_POST_SINGLE_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, payload, sizeof( payload ) ); -} - -/*********************************************************************//** - * @brief - * The sendPOSTFinalResult function sends the overall TD POST result - * and queues the message for transmit on the appropriate CAN channel. - * @details \b Message \b Sent: MSG_ID_TD_POST_FINAL_TEST_RESULT - * @details \b Inputs: none - * @details \b Outputs: TD POST final result msg queued for CAN transmit. - * @param passed TRUE if all TD POST tests passed, FALSE otherwise. - * @return TRUE if message successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendPOSTFinalResult( BOOL passed ) -{ - // Use the generic send helper for transmission. - return sendMessage( MSG_ID_TD_POST_FINAL_TEST_RESULT, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08 *)&passed, sizeof( BOOL ) ); -} - -/*********************************************************************//** - * @brief * The testTDSoftwareResetRequest function handles a request to reset the * TD firmware processor. * @note If reset is successful, this function will not return. Index: firmware/App/TDCommon.h =================================================================== diff -u -r1c21d74bc369572b0fcc5b978adc23dc9ce7c656 -r7166df604166f74ff5eb8667e07947d52ac39cf2 --- firmware/App/TDCommon.h (.../TDCommon.h) (revision 1c21d74bc369572b0fcc5b978adc23dc9ce7c656) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision 7166df604166f74ff5eb8667e07947d52ac39cf2) @@ -25,7 +25,7 @@ #define TD_VERSION_MAJOR 0 #define TD_VERSION_MINOR 0 #define TD_VERSION_MICRO 0 -#define TD_VERSION_BUILD 68 +#define TD_VERSION_BUILD 70 // ********** development build switches **********