Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r457fc704dc96f6da4e14263d576bc3ba479e36a8 -r173e5908bada098006b85c1267147a187d2eaef4 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 457fc704dc96f6da4e14263d576bc3ba479e36a8) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 173e5908bada098006b85c1267147a187d2eaef4) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Michael Garthwaite -* @date (last) 12-Oct-2022 +* @author (last) Dara Navaei +* @date (last) 18-Oct-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -64,6 +64,7 @@ #pragma pack(pop) // ********** private data ********** + static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether an external tester (connected PC) has sent a valid login message. static volatile U16 nextSeqNo = 1; ///< Value of sequence number to use for next transmitted message. @@ -3088,6 +3089,11 @@ HD_VERSIONS_T payload; U08 *payloadPtr = msg.payload; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_VERSION; + msg.hdr.payloadLen = sizeof( HD_VERSIONS_T ); + if ( message->hdr.payloadLen == sizeof( UI_VERSIONS_T ) ) { // Get UI version data from this request msg and have it recorded @@ -3101,11 +3107,6 @@ payload.compatibilityRev = (U32)SW_COMPATIBILITY_REV; getFPGAVersions( &payload.fpgaId, &payload.fpgaMajor, &payload.fpgaMinor, &payload.fpgaLab ); - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_VERSION; - msg.hdr.payloadLen = sizeof( HD_VERSIONS_T ); - // Fill message payload memcpy( payloadPtr, &payload, sizeof( HD_VERSIONS_T ) ); } @@ -3206,25 +3207,27 @@ MESSAGE_T msg; HD_SERVICE_RECORD_T service; DG_SERVICE_AND_USAGE_DATA_T dgData; + U08 *payloadPtr = msg.payload; getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( HD_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); getHDVersionDGServiceAndUsageData( &dgData ); - U08 *payloadPtr = msg.payload; - // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SERVICE_SCHEDULE_DATA; msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); - // Fill message payload - memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); + if ( 0 == message->hdr.payloadLen ) + { + // Fill message payload + memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceDateEpoch, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); + } // 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 );