Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r056ecedb3542bab60491702e621e503948563a65 -r23120d5201ec71f5bf9597c4951524652e3672ad --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 056ecedb3542bab60491702e621e503948563a65) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 23120d5201ec71f5bf9597c4951524652e3672ad) @@ -27,6 +27,7 @@ #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" +#include "SystemCommMessages.h" #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -195,18 +196,20 @@ break; case DG_POST_STATE_COMPLETED: - // set overall HD POST status to "passed" + // Set overall HD POST status to "passed" postPassed = TRUE; - // set overall HD POST completed status to TRUE + // Set overall HD POST completed status to TRUE postCompleted = TRUE; - // TODO - send POST status on CAN - // go to standby mode + // Broadcast final POST passed + sendPOSTFinalResult( TRUE ); + // Go to standby mode requestNewOperationMode( DG_MODE_STAN ); break; case DG_POST_STATE_FAILED: - // TODO - send POST status on CAN - // will want POST faults to wait for us to get here before sending us to fault mode + // Broadcast final POST failed + sendPOSTFinalResult( FALSE ); + // Will want POST faults to wait for us to get here before sending us to fault mode requestNewOperationMode( DG_MODE_FAUL ); break; @@ -259,7 +262,12 @@ if ( ( testStatus == SELF_TEST_STATUS_PASSED ) || ( testStatus == SELF_TEST_STATUS_FAILED ) ) { - result = (DG_POST_STATE_T)((int)postState + 1); // move on to next POST test + BOOL passed = ( testStatus == SELF_TEST_STATUS_PASSED ? TRUE : FALSE ); + + // Broadcast passed POST result + sendPOSTTestResult( (DG_POST_STATE_T)((int)postState), passed ); + // Move on to next POST test + result = (DG_POST_STATE_T)((int)postState + 1); if ( testStatus == SELF_TEST_STATUS_FAILED ) { tempPOSTPassed = FALSE; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r35de566c96433689821b7a21f731df26b40d67ae -r23120d5201ec71f5bf9597c4951524652e3672ad --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 35de566c96433689821b7a21f731df26b40d67ae) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 23120d5201ec71f5bf9597c4951524652e3672ad) @@ -1165,6 +1165,67 @@ /*********************************************************************//** * @brief + * The sendPOSTTestResult function constructs an DG POST test result message + * and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG POST test result msg constructed and queued. + * @param test ID of DG 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( DG_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_DG_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_DG_BROADCAST, ACK_REQUIRED ); + + return result; + +} + +/*********************************************************************//** + * @brief + * The sendPOSTFinalResult function constructs an DG POST final result message + * and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG POST final result msg constructed and queued. + * @param passed TRUE if DG 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_DG_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_DG_BROADCAST, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The sendCommandResponseMsg function constructs a command response to HD * and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r35de566c96433689821b7a21f731df26b40d67ae -r23120d5201ec71f5bf9597c4951524652e3672ad --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 35de566c96433689821b7a21f731df26b40d67ae) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 23120d5201ec71f5bf9597c4951524652e3672ad) @@ -171,6 +171,12 @@ // MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD BOOL sendDGScheduledRunsRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* scheduledRcrdAddress ); +// MSG_ID_DG_POST_SINGLE_TEST_RESULT +BOOL sendPOSTTestResult( DG_POST_STATE_T test, BOOL passed ); + +// MSG_ID_DG_POST_FINAL_TEST_RESULT +BOOL sendPOSTFinalResult( BOOL passed ); + // *********** public test support message functions ********** #ifdef DEBUG_ENABLED