From e2c9f6a8a1b2e66738355caf1d2ca081f0620d38 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 20 Feb 2020 16:13:51 +1100 Subject: [PATCH] GCS_MAVLink: add flags to MAV dataflash log holds various pieces of simple information about a link --- libraries/GCS_MAVLink/GCS_Common.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index f5d93d05a2..acf8558871 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -1482,13 +1482,39 @@ void GCS_MAVLINK::log_mavlink_stats() return; } + enum class Flags { + USING_SIGNING = (1<<0), + ACTIVE = (1<<1), + STREAMING = (1<<2), + PRIVATE = (1<<3), + LOCKED = (1<<4), + }; + + uint8_t flags = 0; + if (signing_enabled()) { + flags |= (uint8_t)Flags::USING_SIGNING; + } + if (is_streaming()) { + flags |= (uint8_t)Flags::STREAMING; + } + if (is_active()) { + flags |= (uint8_t)Flags::ACTIVE; + } + if (is_private()) { + flags |= (uint8_t)Flags::PRIVATE; + } + if (locked()) { + flags |= (uint8_t)Flags::LOCKED; + } + const struct log_MAV pkt = { LOG_PACKET_HEADER_INIT(LOG_MAV_MSG), time_us : AP_HAL::micros64(), chan : (uint8_t)chan, packet_tx_count : send_packet_count, packet_rx_success_count: status->packet_rx_success_count, - packet_rx_drop_count : status->packet_rx_drop_count + packet_rx_drop_count : status->packet_rx_drop_count, + flags : flags, }; AP::logger().WriteBlock(&pkt, sizeof(pkt));