Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r89d0436dc87933ee978e91d9ce4722adbccdf9d1 -rf6834402da295dbbaa827afdff9591ad79f63b15 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 89d0436dc87933ee978e91d9ce4722adbccdf9d1) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f6834402da295dbbaa827afdff9591ad79f63b15) @@ -94,6 +94,11 @@ U32 enableChemicalDisinfect; ///< Enable/disable chemical disinfect. } HD_INSTITUTIONAL_LOCAL_RECORD_T; +typedef struct +{ + U08 topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; +} LOCAL_TOP_SN_T; + // ********** private data ********** #ifndef CARTRIDGE_TEST_BUILD @@ -3335,10 +3340,6 @@ *************************************************************************/ void handleHDSerialNumberRequest( void ) { - typedef struct - { - U08 topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; - } LOCAL_TOP_SN_T; MESSAGE_T msg; HD_SYSTEM_RECORD_T system; U08 i; @@ -3354,28 +3355,23 @@ blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SERIAL_NUMBER_RESPONSE; - // Check if the first element of the serial number is not 0 meaning that we are not sending empty serial number - // to the UI - if ( system.topLevelSN[0] != 0 ) + // Add 1 byte for null terminator + msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; + + for ( i = 0; i < MAX_TOP_LEVEL_SN_CHARS; i++ ) { - // Add 1 byte for null terminator - msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; + // NOTE: A local variable was created to avoid system.topLevelSN in the messages list + // NOTE: For loop was used instead of memory copy to ensure it is not parsed in the messages list script + localTopLevelSN.topLevelSN[ i ] = system.topLevelSN[ i ]; + } - for ( i = 0; i < MAX_TOP_LEVEL_SN_CHARS; i++ ) - { - // NOTE: A local variable was created to avoid system.topLevelSN in the messages list - // NOTE: For loop was used instead of memory copy to ensure it is not parsed in the messages list script - localTopLevelSN.topLevelSN[ i ] = system.topLevelSN[ i ]; - } + // Fill message payload + memcpy( payloadPtr, &localTopLevelSN, sizeof( LOCAL_TOP_SN_T ) ); + payloadPtr += MAX_TOP_LEVEL_SN_CHARS; + *payloadPtr = 0; - // Fill message payload - memcpy( payloadPtr, &localTopLevelSN, sizeof( LOCAL_TOP_SN_T ) ); - payloadPtr += MAX_TOP_LEVEL_SN_CHARS; - *payloadPtr = 0; - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); - } + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** @@ -3713,7 +3709,7 @@ memcpy( payloadPtr, instit, sizeof( HD_INSTITUTIONAL_LOCAL_RECORD_T ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); + serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//**