Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r0eb08506bbe69f0cfc272e0a329591ffdeb3fc95 -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 0eb08506bbe69f0cfc272e0a329591ffdeb3fc95) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -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 -rb30f390acbd6c972d4ecea536b875a409a2c8e77 -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision b30f390acbd6c972d4ecea536b875a409a2c8e77) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -200,7 +200,7 @@ static U32 tmpPressureReadingsLongCount; ///< Number of samples in flow rolling average buffer. static PRESSURE_SELF_TEST_STATE_T pressurePostState; ///< Pressure self test post state. -//static HD_PRESSURE_SENSORS_CAL_RECORD_T pressureSensorsCalRecord; ///< Pressure sensors calibration record. +//static HD_PRESSURE_SENSORS_CAL_RECORD_T pressureSensorsCalRecord; ///< Pressure sensors calibration record. // ********** private function prototypes ********** Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r35f1db1a4e254a69234e50082d0cce0122e6a84c -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 35f1db1a4e254a69234e50082d0cce0122e6a84c) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -7,8 +7,8 @@ * * @file AlarmMgmtSWFaults.h * -* @author (last) Praneeth Bunne -* @date (last) 02-Jul-2026 +* @author (last) Varshini Nagabooshanam +* @date (last) 04-Aug-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -207,6 +207,8 @@ SW_FAULT_ID_PID_CTRL_INVALID_CONTROLLER3 = 176, SW_FAULT_ID_PID_CTRL_INVALID_CONTROLLER4 = 177, SW_FAULT_ID_PID_CTRL_INVALID_SIGNAL = 178, + SW_FAULT_ID_INVALID_RINSEBACK_STATE = 179, + SW_FAULT_ID_TREATMENT_INVALID_RECIRC_STATE = 180, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -reb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9 -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision eb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -120,8 +120,12 @@ S16 h1MaxEncPosition; ///< Reg 278. H1 max encoder position. S16 h1EncPosition; ///< Reg 280. H1 encoder position (1000 steps/rev). U16 h1Status; ///< Reg 282. H1 status. - U32 reserved2; ///< Reg 284. Reserved and available for future use. - U16 reserved3; ///< Reg 288. Reserved and available for future use. + U08 reserved2; ///< Reg 284. Reserved and available for future use. + U08 h1SPICmdStatus; ///< Reg 285. H1 Magellan SPI command status. + U08 h1ReadCount; ///< Reg 286. H1 read count. + U08 h19SPICmdStatus; ///< Reg 287. H19 Magellan SPI command status. + U08 h19ReadCount; ///< Reg 288. H19 read count. + U08 h19ErrorCount; ///< Reg 289. H19 error count S16 h4Period; ///< Reg 290. H4 measured period (10 uSec). S16 h4Torque; ///< Reg 292. H4 measured torque. S16 h4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). @@ -145,15 +149,15 @@ U16 fpgaCompatibilityRev; ///< Reg 328. Compatibility revision. U08 VBTStatus; ///< Reg 330. VBT status register. U08 VBTStatusPWM; ///< Reg 331. VBT PWM status register. - S16 ACPower1Current; ///< Reg 332. AC power current - 1. - S16 ACPower1Voltage; ///< Reg 334. AC power voltage - 1. - S16 ACPower2Current; ///< Reg 336. AC power current - 2. - S16 ACPower2Voltage; ///< Reg 338. AC power voltage - 2. - S16 ACPower3Current; ///< Reg 340. AC power current - 3. - S16 ACPower3Voltage; ///< Reg 342. AC power voltage - 3. + U16 h1OutputWord1; ///< Reg 332. H1 Magellan output word 1. + U16 h1OutputWord2; ///< Reg 334. H1 Magellan output word 2. + U16 h1OutputWord3; ///< Reg 336. H1 Magellan output word 3. + U16 h19OutputWord1; ///< Reg 338. H19 Magellan output word 1. + U16 h19OutputWord2; ///< Reg 340. H19 Magellan output word 2. + U16 h19OutputWord3; ///< Reg 342. H19 Magellan output word 3. S16 h4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. U08 h6RotorStatus; ///< Reg 346. H6 rotor status. - U08 reserved5; ///< Reg 347. Reserved register. + U08 h1ErrorCount; ///< Reg 347. H1 error count. U16 h12Speed; ///< Reg 348. H12 speed (air pump in RPM). U16 h4RotorRevsCounter; ///< Reg 350. H4 rotor revs counter U16 baroManufactInfo; ///< Reg 352. Baro sensor manufacturing information. @@ -211,6 +215,18 @@ U16 nibpCtl; ///< Reg 41. NIBP control register. U16 nibpInflate; ///< Reg 42. NIBP inflate pressure register. U32 h5SetSpeed; ///< Reg 44. H5 ejector motor set speed. + U16 h1CmdHeader; ///< Reg 48. H1 Magellan command header. + U16 h1InputWord1; ///< Reg 50. H1 Magellan input word 1. + U16 h1InputWord2; ///< Reg 52. H1 Magellan input word 2. + U16 h1InputWord3; ///< Reg 54. H1 Magellan input word 3. + U08 h1FPGACmd; ///< Reg 56. H1 Magellan FPGA command register. + U08 h1EnableReset; ///< Reg 57. H1 Magellan enable and reset register. + U16 h19CmdHeader; ///< Reg 58. H19 Magellan command header. + U16 h19InputWord1; ///< Reg 60. H19 Magellan input word 1. + U16 h19InputWord2; ///< Reg 62. H19 Magellan input word 2. + U16 h19InputWord3; ///< Reg 64. H19 Magellan input word 3. + U08 h19FPGACmd; ///< Reg 66. H19 Magellan FPGA command register. + U08 h19EnableReset; ///< Reg 67. H19 Magellan enable and reset register. } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -1687,4 +1703,304 @@ return fpgaSensorReadings.bpHr; } +/*********************************************************************//** + * @brief + * The setH1CmdHeader function sets the H1 Magellan command header. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param cmdHeader H1 Magellan command header. + * @return none + *************************************************************************/ +void setH1CmdHeader( U16 cmdHeader ) +{ + fpgaActuatorSetPoints.h1CmdHeader = cmdHeader; +} + +/*********************************************************************//** + * @brief + * The setH1InputWord1 function sets H1 Magellan input word 1. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 1 value. + * @return none + *************************************************************************/ +void setH1InputWord1( U16 inputWord1 ) +{ + fpgaActuatorSetPoints.h1InputWord1 = inputWord1; +} + +/*********************************************************************//** + * @brief + * The setH1InputWord2 function sets H1 Magellan input word 2. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 2 value. + * @return none + *************************************************************************/ +void setH1InputWord2( U16 inputWord2 ) +{ + fpgaActuatorSetPoints.h1InputWord2 = inputWord2; +} + +/*********************************************************************//** + * @brief + * The setH1InputWord3 function sets H1 Magellan input word 3. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 3 value. + * @return none + *************************************************************************/ +void setH1InputWord3( U16 inputWord3 ) +{ + fpgaActuatorSetPoints.h1InputWord3 = inputWord3; +} + +/*********************************************************************//** + * @brief + * The setH1FPGACmd function sets the H1 Magellan FPGA command register. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param cmd FPGA command value. + * @return none + *************************************************************************/ +void setH1FPGACmd( U08 cmd ) +{ + fpgaActuatorSetPoints.h1FPGACmd = cmd; +} + +/*********************************************************************//** + * @brief + * The setH1EnableReset function sets the H1 Magellan enable/reset register. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param value Enable/reset register value. + * @return none + *************************************************************************/ +void setH1EnableReset( U08 value ) +{ + fpgaActuatorSetPoints.h1EnableReset = value; +} + +/*********************************************************************//** + * @brief + * The setH19CmdHeader function sets the H19 Magellan command header. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param cmdHeader H19 Magellan command header. + * @return none + *************************************************************************/ +void setH19CmdHeader( U16 cmdHeader ) +{ + fpgaActuatorSetPoints.h19CmdHeader = cmdHeader; +} + +/*********************************************************************//** + * @brief + * The setH19InputWord1 function sets H19 Magellan input word 1. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 1 value. + * @return none + *************************************************************************/ +void setH19InputWord1( U16 inputWord1 ) +{ + fpgaActuatorSetPoints.h19InputWord1 = inputWord1; +} + +/*********************************************************************//** + * @brief + * The setH19InputWord2 function sets H19 Magellan input word 2. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 2 value. + * @return none + *************************************************************************/ +void setH19InputWord2( U16 inputWord2 ) +{ + fpgaActuatorSetPoints.h19InputWord2 = inputWord2; +} + +/*********************************************************************//** + * @brief + * The setH19InputWord3 function sets H19 Magellan input word 3. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param inputWord Input word 3 value. + * @return none + *************************************************************************/ +void setH19InputWord3( U16 inputWord3 ) +{ + fpgaActuatorSetPoints.h19InputWord3 = inputWord3; +} + +/*********************************************************************//** + * @brief + * The setH19FPGACmd function sets the H19 Magellan FPGA command register. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param cmd FPGA command value. + * @return none + *************************************************************************/ +void setH19FPGACmd( U08 cmd ) +{ + fpgaActuatorSetPoints.h19FPGACmd = cmd; +} + +/*********************************************************************//** + * @brief + * The setH19EnableReset function sets the H19 Magellan enable/reset register. + * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Outputs: none + * @param value Enable/reset register value. + * @return none + *************************************************************************/ +void setH19EnableReset( U08 value ) +{ + fpgaActuatorSetPoints.h19EnableReset = value; +} + +/*********************************************************************//** + * @brief + * The getH1SPICmdStatus function reads the H1 SPI command status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 SPI command status. + *************************************************************************/ +U08 getH1SPICmdStatus( void ) +{ + return fpgaSensorReadings.h1SPICmdStatus; +} + +/*********************************************************************//** + * @brief + * The getH1ReadCount function reads the H1 status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 motor status. + *************************************************************************/ +U08 getH1ReadCount( void ) +{ + return fpgaSensorReadings.h1ReadCount; +} + +/*********************************************************************//** + * @brief + * The getH1ErrorCount function shows error count of H1. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 error status. + *************************************************************************/ +U08 getH1ErrorCount( void ) +{ + return fpgaSensorReadings.h1ErrorCount; +} + +/*********************************************************************//** + * @brief + * The getH1OutputWord1 function reads H1 output word 1. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 output word 1. + *************************************************************************/ +U16 getH1OutputWord1( void ) +{ + return fpgaSensorReadings.h1OutputWord1; +} + +/*********************************************************************//** + * @brief + * The getH1OutputWord2 function reads H1 output word 2. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 output word 2. + *************************************************************************/ +U16 getH1OutputWord2( void ) +{ + return fpgaSensorReadings.h1OutputWord2; +} + +/*********************************************************************//** + * @brief + * The getH1OutputWord3 function reads H1 output word 3. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H1 output word 3. + *************************************************************************/ +U16 getH1OutputWord3( void ) +{ + return fpgaSensorReadings.h1OutputWord3; +} + +/*********************************************************************//** + * @brief + * The getH19SPICmdStatus function reads the H19 SPI command status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 SPI command status. + *************************************************************************/ +U08 getH19SPICmdStatus( void ) +{ + return fpgaSensorReadings.h19SPICmdStatus; +} + +/*********************************************************************//** + * @brief + * The getH19ReadCount function reads the H19 status. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 motor status. + *************************************************************************/ +U08 getH19ReadCount( void ) +{ + return fpgaSensorReadings.h19ReadCount; +} + +/*********************************************************************//** + * @brief + * The getH19ErrorCount function shows error count of H19. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 error status. + *************************************************************************/ +U08 getH19ErrorCount( void ) +{ + return fpgaSensorReadings.h19ErrorCount; +} + +/*********************************************************************//** + * @brief + * The getH19OutputWord1 function reads H19 output word 1. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 output word 1. + *************************************************************************/ +U16 getH19OutputWord1( void ) +{ + return fpgaSensorReadings.h19OutputWord1; +} + +/*********************************************************************//** + * @brief + * The getH19OutputWord2 function reads H19 output word 2. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 output word 2. + *************************************************************************/ +U16 getH19OutputWord2( void ) +{ + return fpgaSensorReadings.h19OutputWord2; +} + +/*********************************************************************//** + * @brief + * The getH19OutputWord3 function reads H19 output word 3. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return H19 output word 3. + *************************************************************************/ +U16 getH19OutputWord3( void ) +{ + return fpgaSensorReadings.h19OutputWord3; +} + /**@}*/ Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -reb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9 -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision eb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -177,6 +177,34 @@ U16 getFPGASyringePumpDACSetting( void ); U16 getFPGASyringePumpDACStoredSetting( void ); +void setH1CmdHeader( U16 cmdHeader ); +void setH1InputWord1( U16 inputWord1 ); +void setH1InputWord2( U16 inputWord2 ); +void setH1InputWord3( U16 inputWord3 ); +void setH1FPGACmd( U08 cmd ); +void setH1EnableReset( U08 value ); + +void setH19CmdHeader( U16 cmdHeader ); +void setH19InputWord1( U16 inputWord1 ); +void setH19InputWord2( U16 inputWord2 ); +void setH19InputWord3( U16 inputWord3 ); +void setH19FPGACmd( U08 cmd ); +void setH19EnableReset( U08 value ); + +U08 getH1SPICmdStatus( void ); +U08 getH1ReadCount( void ); +U08 getH1ErrorCount( void ); +U16 getH1OutputWord1( void ); +U16 getH1OutputWord2( void ); +U16 getH1OutputWord3( void ); + +U08 getH19SPICmdStatus( void ); +U08 getH19ReadCount( void ); +U08 getH19ErrorCount( void ); +U16 getH19OutputWord1( void ); +U16 getH19OutputWord2( void ); +U16 getH19OutputWord3( void ); + /**@}*/ #endif Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r35f1db1a4e254a69234e50082d0cce0122e6a84c -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 35f1db1a4e254a69234e50082d0cce0122e6a84c) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -7,8 +7,8 @@ * * @file Messaging.c * -* @author (last) suresh -* @date (last) 05-Aug-2026 +* @author (last) Santhosh Reddy +* @date (last) 07-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 }, @@ -227,6 +231,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. @@ -557,6 +563,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 ******************** // *********************************************************************** @@ -648,7 +702,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 *************************************************************************/ @@ -788,45 +896,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/Tasks/TaskGeneral.c =================================================================== diff -u -reb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9 -r468cf0b9c944111231359948c833c20ad92219d0 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision eb2acaea0b9f8a04bc5d4754fa88efeeb822d0b9) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 468cf0b9c944111231359948c833c20ad92219d0) @@ -22,6 +22,7 @@ #include "Ejector.h" #include "Messaging.h" #include "OperationModes.h" +#include "PinchValve.h" #include "Pressures.h" #include "Switches.h" #include "SystemCommTD.h" @@ -113,6 +114,7 @@ // Control pinch valves execValvesController(); + execPinchValveFunction(); // Control ejector execEjectorController();