Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r120487ddf3e3d69d1de5094d5252c037588e2ed8 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 120487ddf3e3d69d1de5094d5252c037588e2ed8) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -105,6 +105,7 @@ /// Software configuration enums typedef enum software_configurations { + SW_CONFIG_DISABLE_ALARM_AUDIO = 0, /// SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS, ///< Software configuration disable syringe pump alarms. SW_CONFIG_DISABLE_SYRINGE_PUMP, ///< Software configuration disable syringe pump. NUM_OF_SW_CONFIGS ///< Number of software configurations. Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r9cc543b1c2508280767573e20eddd94e68be1fb5 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 9cc543b1c2508280767573e20eddd94e68be1fb5) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -26,7 +26,7 @@ #include "Ejector.h" //#include "Fans.h" #include "FpgaTD.h" -//#include "Integrity.h" +#include "Integrity.h" #include "Messaging.h" #include "ModeInitPOST.h" //#include "NVDataMgmt.h" @@ -159,7 +159,7 @@ break; case POST_STATE_FW_INTEGRITY: -// testStatus = execIntegrityTest(); + testStatus = execIntegrityTest(); postState = handlePOSTStatus( testStatus ); break; @@ -172,12 +172,12 @@ break; case POST_STATE_WATCHDOG: -// testStatus = execWatchdogTest(); + testStatus = execWatchdogTest(); postState = handlePOSTStatus( testStatus ); break; case POST_STATE_SAFETY_SHUTDOWN: -// testStatus = execSafetyShutdownTest(); + testStatus = execSafetyShutdownTest(); postState = handlePOSTStatus( testStatus ); break; @@ -219,7 +219,7 @@ break; case POST_STATE_ALARM_LAMP: -// testStatus = execAlarmLampTest(); + testStatus = execAlarmLampTest(); postState = handlePOSTStatus( testStatus ); break; @@ -453,7 +453,7 @@ if ( testStatus == SELF_TEST_STATUS_PASSED ) { // Broadcast passed POST result -// sendPOSTTestResult( (HD_POST_STATE_T)((int)postState), TRUE ); + sendPOSTTestResult( (TD_POST_STATE_T)((int)postState), TRUE ); // Move on to next POST test result = (TD_POST_STATE_T)((int)postState + 1); } @@ -462,8 +462,8 @@ // At least one POST has failed tempPOSTPassed = FALSE; // Broadcast failed POST results -// sendPOSTTestResult( (HD_POST_STATE_T)((int)postState), FALSE ); -// sendPOSTFinalResult( FALSE ); + sendPOSTTestResult( (TD_POST_STATE_T)((int)postState), FALSE ); + sendPOSTFinalResult( FALSE ); // Test that failed should have triggered a fault which will request fault mode, so should POST state machine should never see FAILED state and will fault if it does result = POST_STATE_FAILED; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r70f10c77f4f9a48d51030c00504d520fe25d0ba9 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 70f10c77f4f9a48d51030c00504d520fe25d0ba9) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -28,6 +28,7 @@ #include "ModeUpdate.h" //#include "NVDataMgmt.h" #include "OperationModes.h" +#include "SystemCommTD.h" #include "TaskGeneral.h" #include "Timers.h" @@ -460,59 +461,59 @@ *************************************************************************/ CONFIRMATION_REQUEST_STATUS_T getConfirmationRequestStatus( GENERIC_CONFIRM_ID_T requestID ) { -// BOOL pending = FALSE; -// U32 pendingIndex = 0; + BOOL pending = FALSE; + U32 pendingIndex = 0; CONFIRMATION_REQUEST_STATUS_T status = CONFIRMATION_REQUEST_STATUS_PENDING; -// U32 i; + U32 i; -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( confirmRequests[ i ].requestID == requestID ) -// { -// status = confirmRequests[ i ].status; -// if ( status != CONFIRMATION_REQUEST_STATUS_PENDING ) -// { -// // Send UI clear -// if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) -// { -// sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); -// } -// else -// { -// sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, 0 ); -// } -// -// // Clear the confirmation request, it is done and consumed -// confirmRequests[ i ].requestID = GENERIC_CONFIRM_ID_NONE; -// confirmRequests[ i ].requestType = GENERIC_CONFIRM_CMD_REQUEST_OPEN; -// confirmRequests[ i ].timeStamp = 0; -// confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_UNUSED; -// } -// } -// else if ( CONFIRMATION_REQUEST_STATUS_PENDING == confirmRequests[ i ].status ) -// { -// if ( TRUE == pending ) -// { -// // Is this newer than other pending request? -// if ( confirmRequests[ i ].timeStamp > confirmRequests[ pendingIndex ].timeStamp ) -// { -// pendingIndex = i; -// } -// } -// else -// { -// pendingIndex = i; -// pending = TRUE; -// } -// } -// } -// -// if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) -// { -// // Last confirmation cleared, pending request must be resent to UI -// sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, confirmRequests[ pendingIndex ].requestType, 0 ); -// } + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( confirmRequests[ i ].requestID == requestID ) + { + status = confirmRequests[ i ].status; + if ( status != CONFIRMATION_REQUEST_STATUS_PENDING ) + { + // Send UI clear + if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) + { + sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); + } + else + { + sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, 0 ); + } + // Clear the confirmation request, it is done and consumed + confirmRequests[ i ].requestID = GENERIC_CONFIRM_ID_NONE; + confirmRequests[ i ].requestType = GENERIC_CONFIRM_CMD_REQUEST_OPEN; + confirmRequests[ i ].timeStamp = 0; + confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_UNUSED; + } + } + else if ( CONFIRMATION_REQUEST_STATUS_PENDING == confirmRequests[ i ].status ) + { + if ( TRUE == pending ) + { + // Is this newer than other pending request? + if ( confirmRequests[ i ].timeStamp > confirmRequests[ pendingIndex ].timeStamp ) + { + pendingIndex = i; + } + } + else + { + pendingIndex = i; + pending = TRUE; + } + } + } + + if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) + { + // Last confirmation cleared, pending request must be resent to UI + sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, confirmRequests[ pendingIndex ].requestType, 0 ); + } + return status; } @@ -551,40 +552,40 @@ *************************************************************************/ GENERIC_CONFIRM_ID_T addConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) { -// U32 i; -// BOOL confirmAlreadyPending = FALSE; + U32 i; + BOOL confirmAlreadyPending = FALSE; GENERIC_CONFIRM_ID_T newID = GENERIC_CONFIRM_ID_NONE; -// // Check to make sure specified confirmation is not already pending -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( ( confirmRequests[ i ].requestID == requestID ) && -// ( confirmRequests[ i ].status != CONFIRMATION_REQUEST_STATUS_UNUSED ) ) -// { -// confirmAlreadyPending = TRUE; -// break; -// } -// } -// -// // If not already pending, add confirmation to list of pending confirmations and send to UI to be displayed -// if ( confirmAlreadyPending != TRUE ) -// { -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[ i ].status ) -// { -// // Save the confirmation request info -// confirmRequests[ i ].requestID = requestID; -// confirmRequests[ i ].requestType = requestType; -// confirmRequests[ i ].timeStamp = getMSTimerCount(); -// confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; -// newID = requestID; -// sendConfirmationRequest( requestID, requestType, rejectReason ); -// break; -// } -// } -// } + // Check to make sure specified confirmation is not already pending + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( ( confirmRequests[ i ].requestID == requestID ) && + ( confirmRequests[ i ].status != CONFIRMATION_REQUEST_STATUS_UNUSED ) ) + { + confirmAlreadyPending = TRUE; + break; + } + } + // If not already pending, add confirmation to list of pending confirmations and send to UI to be displayed + if ( confirmAlreadyPending != TRUE ) + { + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[ i ].status ) + { + // Save the confirmation request info + confirmRequests[ i ].requestID = requestID; + confirmRequests[ i ].requestType = requestType; + confirmRequests[ i ].timeStamp = getMSTimerCount(); + confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; + newID = requestID; + sendConfirmationRequest( requestID, requestType, rejectReason ); + break; + } + } + } + return newID; } Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -40,6 +40,18 @@ U32 subMode; ///< Current sub-mode of current operating mode } OP_MODE_PAYLOAD_T; +/// Payload structure for generic confirmation request +typedef struct +{ + U32 requestID; ///< Generic request ID. + U32 requestType; ///< Generic request type. + U32 rejectReason; ///< Reject reason. + F32 genericPayload1; ///< Generic payload 1. + F32 genericPayload2; ///< Generic payload 2. + F32 genericPayload3; ///< Generic payload 3. + F32 genericPayload4; ///< Generic payload 4. +} GENERIC_CONFIRMATION_REQUEST_T; + // ********** public function prototypes ********** void initOperationModes( void ); // Initialize this unit Index: firmware/App/Services/CpldInterface.c =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Services/CpldInterface.c (.../CpldInterface.c) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Services/CpldInterface.c (.../CpldInterface.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -19,7 +19,9 @@ #include "mibspi.h" #include "CpldInterface.h" +#include "FpgaTD.h" #include "GPIO.h" +#include "InternalADC.h" #include "Messaging.h" #include "Timers.h" @@ -294,16 +296,16 @@ { case SAFETY_SHUTDOWN_SELF_TEST_STATE_START: { -// F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ); -// -// safetyShutdownSelfTestState = SAFETY_SHUTDOWN_SELF_TEST_STATE_IN_PROGRESS; -// -// // Verify 24V is up -// if ( v24 < MIN_24V_LEVEL_ON_SAFETY_RECOVER ) -// { -// SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_24V_INITIAL, v24 ) -// safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; -// } + F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS_1 ); //ToDo + + safetyShutdownSelfTestState = SAFETY_SHUTDOWN_SELF_TEST_STATE_IN_PROGRESS; + + // Verify 24V is up + if ( v24 < MIN_24V_LEVEL_ON_SAFETY_RECOVER ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_TD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_24V_INITIAL, v24 ) + safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; + } safetyShutdownSelfTestTimerCount = getMSTimerCount(); activateSafetyShutdown(); } @@ -312,15 +314,15 @@ case SAFETY_SHUTDOWN_SELF_TEST_STATE_IN_PROGRESS: if ( TRUE == didTimeout( safetyShutdownSelfTestTimerCount, SAFETY_SHUTDOWN_POST_TIMEOUT_MS ) ) { -// F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ); -// F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); -// -// // Verify 24V is down when w.d. expired -// if ( v24 > MAX_24V_LEVEL_ON_SAFETY_SHUTDOWN ) -// { -// SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_24V_NOT_CUT, v24 ) -// safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; -// } + F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS_1 ); //ToDo + F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); + + // Verify 24V is down when w.d. expired + if ( v24 > MAX_24V_LEVEL_ON_SAFETY_SHUTDOWN ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_TD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_24V_NOT_CUT, v24 ) + safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; + } safetyShutdownSelfTestTimerCount = getMSTimerCount(); clrSafetyShutdownSignal(); safetyShutdownActivated = FALSE; @@ -331,19 +333,19 @@ case SAFETY_SHUTDOWN_SELF_TEST_STATE_RECOVER: if ( TRUE == didTimeout( safetyShutdownSelfTestTimerCount, SAFETY_SHUTDOWN_RECOVERY_TIME_MS ) ) { -// F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ); -// F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); -// -// // Verify 24V is down when w.d. recovered -// if ( v24 < MIN_24V_LEVEL_ON_SAFETY_RECOVER ) -// { -// SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_NO_24V_RESTORE, v24 ) -// safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; -// } -// else -// { -// safetyShutdownSelfTestStatus = SELF_TEST_STATUS_PASSED; -// } + F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS_1 ); + F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); + + // Verify 24V is down when w.d. recovered + if ( v24 < MIN_24V_LEVEL_ON_SAFETY_RECOVER ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_TD_SAFETY_SHUTDOWN_POST_TEST_FAILED, (F32)SAFETY_POST_NO_24V_RESTORE, v24 ) + safetyShutdownSelfTestStatus = SELF_TEST_STATUS_FAILED; + } + else + { + safetyShutdownSelfTestStatus = SELF_TEST_STATUS_PASSED; + } safetyShutdownSelfTestState = SAFETY_SHUTDOWN_SELF_TEST_STATE_COMPLETE; result = safetyShutdownSelfTestStatus; } Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r70f10c77f4f9a48d51030c00504d520fe25d0ba9 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 70f10c77f4f9a48d51030c00504d520fe25d0ba9) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -111,6 +111,7 @@ { MSG_ID_DD_OP_MODE_DATA, &setDDOpMode }, { MSG_ID_DD_GEN_DIALYSATE_MODE_DATA, &setDialysateData }, { MSG_ID_DD_PRESSURES_DATA, &setDialysatePressure }, + { MSG_ID_OFF_BUTTON_PRESS_REQUEST, &handleOffButtonConfirmMsgFromUI }, { MSG_ID_UI_TREATMENT_PARAMS_TO_VALIDATE, &validateAndSetTreatmentParameters }, { MSG_ID_UI_INITIATE_TREATMENT_WORKFLOW, &signalUserInitiateTreatment }, { MSG_ID_UI_UF_PAUSE_RESUME_REQUEST, &signalPauseResumeUF }, @@ -121,6 +122,7 @@ { MSG_ID_UI_ADJUST_DISPOSABLES_CONFIRM_REQUEST, &handleAutoLoadRequest }, { MSG_ID_UI_ADJUST_DISPOSABLES_REMOVAL_CONFIRM_REQUEST, &handleAutoEjectRequest }, { MSG_ID_FFU_SIGNAL_TD_UPDATE_AVAILABLE, &handleUpdateAvailable }, + { MSG_ID_UI_CONFIRMATION_RESULT_RESPONSE, &handleUIConfirmationResponse }, { MSG_ID_TD_SOFTWARE_RESET_REQUEST, &testTDSoftwareResetRequest }, { MSG_ID_TD_BUBBLE_OVERRIDE_REQUEST, &testBubbleDetectOverride }, { MSG_ID_TD_BUBBLE_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testBubblesDataPublishIntervalOverride }, @@ -508,7 +510,59 @@ return result; } +/*********************************************************************//** + * @brief + * The handleOffButtonConfirmMsgFromUI function handles a response to an + * off button message to the UI. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ) +{ + OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T payload; + if ( message->hdr.payloadLen == sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ) + { + memcpy( &payload, message->payload, sizeof(OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T) ); + userConfirmOffButton( payload.confirmed ); + } + return TRUE; +} + +/*********************************************************************//** + * @brief + * The handleUIConfirmationResponse function handles a UI response for + * confirmation request. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL handleUIConfirmationResponse( MESSAGE_T *message ) +{ + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen == 2 * sizeof(U32) ) + { + U32 request_id; + U32 status; + + memcpy( &request_id, payloadPtr, sizeof(U32) ); + payloadPtr += sizeof(U32); + memcpy( &status, payloadPtr, sizeof(U32) ); + + if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) + { + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_TD_2_UI, FALSE ); + return TRUE; +} + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** @@ -722,6 +776,67 @@ /*********************************************************************//** * @brief + * The sendPOSTTestResult function sends the result of a single TD POST + * test to the UI. + * @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 ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + U32 testID = (U32)test; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_TD_POST_SINGLE_TEST_RESULT; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &passed, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &testID, sizeof( U32) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_BROADCAST, ACK_REQUIRED ); + + return result; + +} + +/*********************************************************************//** + * @brief + * The sendPOSTFinalResult function sends the overall TD POST result + * and queues the message for transmit on the appropriate CAN channel. + * @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 ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_TD_POST_FINAL_TEST_RESULT; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( payloadPtr, &passed, sizeof( BOOL ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_BROADCAST, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @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/Services/Messaging.h =================================================================== diff -u -r70f10c77f4f9a48d51030c00504d520fe25d0ba9 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Services/Messaging.h (.../Messaging.h) (revision 70f10c77f4f9a48d51030c00504d520fe25d0ba9) +++ firmware/App/Services/Messaging.h (.../Messaging.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -14,15 +14,16 @@ * @date (original) 01-Aug-2024 * ***************************************************************************/ - -#ifndef __MESSAGING_H__ -#define __MESSAGING_H__ +#ifndef __MESSAGING_H__ +#define __MESSAGING_H__ + #include "TDCommon.h" #include "TDDefs.h" #include "MessageSupport.h" #include "MsgQueues.h" - +#include "OperationModes.h" + /** * @defgroup Messaging Messaging * @brief The system communication messages unit provides helper functions @@ -35,7 +36,7 @@ // ********** public definitions ********** #define ACK_REQUIRED TRUE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. -#define ACK_NOT_REQUIRED FALSE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. +#define ACK_NOT_REQUIRED FALSE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. #pragma pack(push, 1) /// Payload record structure for ACK response. @@ -138,13 +139,13 @@ F32 maxHeparinBolusVolumeML; ///< Max heparin bolus volume in mL. U32 enableChemicalDisinfect; ///< Enable/disable chemical disinfect. } HD_INSTITUTIONAL_LOCAL_RECORD_T; - -// ********** public function prototypes ********** -// Serialize message +// ********** public function prototypes ********** + +// Serialize message U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); -// ACK MSG +// ACK MSG BOOL sendACKMsg( MESSAGE_T *message ); // Handle version request message @@ -160,17 +161,21 @@ BOOL handleUICheckIn( MESSAGE_T *message ); BOOL handleTesterLogInRequest( MESSAGE_T *message ); BOOL handleUpdateAvailable( MESSAGE_T *message ); +BOOL handleOffButtonConfirmMsgFromUI( MESSAGE_T *message ); +BOOL handleUIConfirmationResponse( MESSAGE_T *message ); BOOL testTDSoftwareResetRequest( MESSAGE_T *message ); // Test send message helper functions BOOL sendEvent( TD_EVENT_ID_T event, EVENT_DATA_T dat1, EVENT_DATA_T dat2 ); BOOL sendOffButtonMsgToUI( U08 prompt ); +BOOL sendPOSTTestResult( TD_POST_STATE_T test, BOOL passed ); +BOOL sendPOSTFinalResult( BOOL passed ); BOOL testSetTestConfiguration( MESSAGE_T *message ); BOOL testGetTestConfiguration( MESSAGE_T *message ); BOOL testResetAllTestConfigurations( MESSAGE_T *message ); /**@}*/ -#endif +#endif Index: firmware/App/Services/SystemCommTD.c =================================================================== diff -u -rf8a6d0d2b55d834e1e25ec98370e538ff547e148 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision f8a6d0d2b55d834e1e25ec98370e538ff547e148) +++ firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -16,7 +16,8 @@ ***************************************************************************/ #include // For memcpy() - + +#include "Buttons.h" #include "can.h" #include "sci.h" #include "sys_dma.h" @@ -302,6 +303,42 @@ /*********************************************************************//** * @brief + * The sendConfirmationRequest function sends a confirmation request to UI + * @details /b Inputs: requestID, requestType, rejectReason + * @details /b Outputs: none + * @param requestID ID of confirmation request + * @param requestType Type of confirmation request command + * @param rejectReason Reject reason if applicable + * @return none + *************************************************************************/ +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + GENERIC_CONFIRMATION_REQUEST_T request; + + // Populate request structure + request.requestID = (U32)requestID; + request.requestType = (U32)requestType; + request.rejectReason = rejectReason; + // Optional payload defaults + request.genericPayload1 = 0; + request.genericPayload2 = 0; + request.genericPayload3 = 0; + request.genericPayload4 = 0; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_TD_UI_CONFIRMATION_REQUEST; + // Payload size + msg.hdr.payloadLen = sizeof( GENERIC_CONFIRMATION_REQUEST_T ); + // Copy payload + memcpy( payloadPtr,&request, sizeof( GENERIC_CONFIRMATION_REQUEST_T ) ); + // Serialize and send + serializeMessage( msg, COMM_BUFFER_OUT_CAN_TD_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The getInBufferID function gets the incoming communication buffer ID for * a given buffer index. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given buffer index is invalid. @@ -364,7 +401,7 @@ * @return none *************************************************************************/ void processReceivedMessage( MESSAGE_T *message ) -{ +{ // Handle any messages from other sub-systems handleIncomingMessage( message ); } Index: firmware/App/Services/SystemCommTD.h =================================================================== diff -u -r395522dffef1348e176564925656012f529c1910 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Services/SystemCommTD.h (.../SystemCommTD.h) (revision 395522dffef1348e176564925656012f529c1910) +++ firmware/App/Services/SystemCommTD.h (.../SystemCommTD.h) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -19,6 +19,7 @@ #define __SYSTEM_COMM_TD_H__ #include "TDCommon.h" +#include "TDDefs.h" #include "CommBuffers.h" #include "MsgQueues.h" #include "SystemComm.h" @@ -57,7 +58,8 @@ BOOL uiCommunicated( void ); BOOL isOnlyCANNode( void ); void setOnlyCANNode( BOOL only ); -void clearCANXmitBuffers( void ); +void clearCANXmitBuffers( void ); +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ); /**@}*/