From e2a32aab76dc682e70294733987c05712ab0aafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= <beat-kueng@gmx.net> Date: Mon, 9 Oct 2017 17:17:12 +0200 Subject: [PATCH] mavlink_main: add support for autopilot_version.uid2 --- src/modules/mavlink/mavlink_main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 9ffe637744..dfd45800bb 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1330,6 +1330,13 @@ void Mavlink::send_autopilot_capabilites() board_get_uuid32(uid); msg.uid = (((uint64_t)uid[PX4_CPU_UUID_WORD32_UNIQUE_M]) << 32) | uid[PX4_CPU_UUID_WORD32_UNIQUE_H]; +#ifndef BOARD_HAS_NO_UUID + px4_guid_t px4_guid; + board_get_px4_guid(px4_guid); + static_assert(sizeof(px4_guid_t) == sizeof(msg.uid2), "GUID byte length mismatch"); + memcpy(&msg.uid2, &px4_guid, sizeof(msg.uid2)); +#endif /* BOARD_HAS_NO_UUID */ + #ifdef CONFIG_ARCH_BOARD_SITL // To avoid that multiple SITL instances have the same UUID, we add the mavlink // system ID. We subtract 1, so that the first UUID remains unchanged given the @@ -1337,6 +1344,7 @@ void Mavlink::send_autopilot_capabilites() // // Note that the UUID show in `ver` will still be the same for all instances. msg.uid += mavlink_system.sysid - 1; + msg.uid2[0] += mavlink_system.sysid - 1; #endif mavlink_msg_autopilot_version_send_struct(get_channel(), &msg); } -- GitLab