Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r92a1989e9c81d5e6f3d1a79430716b668dd5d31f -r82a8a3cf0ea04c4d2732a8ea912cfb85b981ec5f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 92a1989e9c81d5e6f3d1a79430716b668dd5d31f) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 82a8a3cf0ea04c4d2732a8ea912cfb85b981ec5f) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Dara Navaei -* @date (last) 11-Jan-2023 +* @author (last) Sean Nash +* @date (last) 27-Jan-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -94,7 +94,6 @@ U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) { BOOL result = 0; - BOOL error = FALSE; BOOL blocked = FALSE; U32 msgSize = 0; U32 sizeMod, sizePad; @@ -167,17 +166,13 @@ { if ( FALSE == addMsgToPendingACKList( &msg, buffer, data, msgSize ) ) { - error = TRUE; - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MSG_PENDING_ACK_LIST_FULL ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MSG_PENDING_ACK_LIST_FULL, (U32)(msg.hdr.msgID) ) } } } - if ( FALSE == error ) - { - // Add serialized message data to appropriate out-going comm buffer - result = addToCommBuffer( buffer, data, msgSize ); - } + // Add serialized message data to appropriate out-going comm buffer + result = addToCommBuffer( buffer, data, msgSize ); } else { @@ -796,14 +791,14 @@ *************************************************************************/ void handleUITreatmentLogDataRequest( MESSAGE_T *message ) { + BOOL ack = FALSE; + if ( 0 == message->hdr.payloadLen ) { + ack = TRUE; sendTreatmentLogDataToUI(); } - else - { - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); - } + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, ack ); } /*********************************************************************//** @@ -3117,6 +3112,30 @@ /*********************************************************************//** * @brief + * The sendFWVersionRequest function constructs a firmware version request + * message and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Firmware version request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendFWVersionRequest( void ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_REQUEST_FW_VERSIONS; + msg.hdr.payloadLen = sizeof( UI_VERSIONS_T ); // usually UI sends this request w/ UI version info - we will leave that blank + + // 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_2_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleUIVersionResponse function handles a response to request for * UI version information. * @details Inputs: none