Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r3533955f242cec0505e8826e0e2d96f7b79ad499 -ra9160f295f6baf4fad4a8e2a739782f6df7d177a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3533955f242cec0505e8826e0e2d96f7b79ad499) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a9160f295f6baf4fad4a8e2a739782f6df7d177a) @@ -2290,6 +2290,117 @@ } } +/*********************************************************************//** + * @brief + * The sendPOSTTestResult function constructs an HD POST test result message + * and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: HD POST test result msg constructed and queued. + * @param test ID of HD POST test + * @param passed TRUE if POST test passed, FALSE if not + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPOSTTestResult( HD_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_HD_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_HD_BROADCAST, ACK_REQUIRED ); + + return result; + +} + +/*********************************************************************//** + * @brief + * The sendPOSTFinalResult function constructs an HD POST final result message + * and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: HD POST final result msg constructed and queued. + * @param passed TRUE if HD POST passed, FALSE if not + * @return TRUE if msg 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_HD_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_HD_BROADCAST, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleDGPOSTFinalResult function handles a DG POST final result message. + * @details Inputs: none + * @details Outputs: DG POST final result delivered to InitPOST mode. + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDGPOSTFinalResult( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( BOOL ) ) + { + U08 *payloadPtr = message->payload; + BOOL passed; + + memcpy( &passed, payloadPtr, sizeof( BOOL ) ); + + // TODO - handle DG POST final result + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The handleUIPOSTFinalResult function handles a UI POST final result message. + * @details Inputs: none + * @details Outputs: UI POST final result delivered to InitPOST mode. + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleUIPOSTFinalResult( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof( BOOL ) ) + { + U08 *payloadPtr = message->payload; + BOOL passed; + + memcpy( &passed, payloadPtr, sizeof( BOOL ) ); + + // TODO - handle UI POST final result + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + /*********************************************************************//** * @brief * The handleOffButtonConfirmMsgFromUI function handles a response to an