Skip to content

Commit

Permalink
Fix publishing guid and hwinfo topics and add timestamp to all versio…
Browse files Browse the repository at this point in the history
…n topics.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Mar 4, 2024
1 parent 583ec03 commit 7b2170f
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ int board_determine_hw_info(void)
orb_advert_t hw_info_pub = orb_advertise(ORB_ID(hw_info), NULL);

uint32_t fpga_version = getreg32(FPGA_VER_REGISTER); // todo: replace eventually with device_boot_info
uint64_t timestamp = hrt_absolute_time();

memset(&ver_str, 0, sizeof(ver_str));
memset(&ver, 0, sizeof(ver));
Expand Down Expand Up @@ -329,11 +330,16 @@ int board_determine_hw_info(void)

/* Make local copies of guid and hwinfo */

memcpy(&guid, device_serial_number, min(sizeof(device_serial_number), sizeof(guid)));
memcpy(&hwinfo, hw_info, min(sizeof(hwinfo), sizeof(hw_info)));
memcpy(guid.mfguid, device_serial_number, min(sizeof(device_serial_number), sizeof(guid.mfguid)));
memcpy(hwinfo.hw_info, hw_info, min(sizeof(hwinfo.hw_info), sizeof(hw_info)));

/* Then publish the topics */

ver_str.timestamp = timestamp;
ver.timestamp = timestamp;
guid.timestamp = timestamp;
hwinfo.timestamp = timestamp;

orb_publish(ORB_ID(system_version_string), &ver_str_pub, &ver_str);
orb_publish(ORB_ID(system_version), &ver_pub, &ver);
orb_publish(ORB_ID(guid), &mfguid_pub, &guid);
Expand Down

0 comments on commit 7b2170f

Please sign in to comment.