diff --git a/libraries/AP_Logger/LogStructure.h b/libraries/AP_Logger/LogStructure.h index 98f14d735a..64478a334d 100644 --- a/libraries/AP_Logger/LogStructure.h +++ b/libraries/AP_Logger/LogStructure.h @@ -1384,6 +1384,8 @@ struct PACKED log_Arm_Disarm { "MODE", "QMBB", "TimeUS,Mode,ModeNum,Rsn", "s---", "F---" }, \ { LOG_RFND_MSG, sizeof(log_RFND), \ "RFND", "QBCBB", "TimeUS,Instance,Dist,Stat,Orient", "s#m--", "F-B--" }, \ + { LOG_RFND2_MSG, sizeof(log_RFND), \ + "RFN2", "QBCBB", "TimeUS,Instance,Dist,Stat,Orient", "s#m--", "F-B--" }, \ { LOG_MAV_STATS, sizeof(log_MAV_Stats), \ "DMS", "IIIIIBBBBBBBBB", "TimeMS,N,Dp,RT,RS,Fa,Fmn,Fmx,Pa,Pmn,Pmx,Sa,Smn,Smx", "s-------------", "C-------------" }, \ { LOG_BEACON_MSG, sizeof(log_Beacon), \ @@ -1772,7 +1774,7 @@ enum LogMessages : uint8_t { LOG_ARM_DISARM_MSG, LOG_OA_BENDYRULER_MSG, LOG_OA_DIJKSTRA_MSG, - + LOG_RFND2_MSG, _LOG_LAST_MSG_ }; diff --git a/libraries/AP_RangeFinder/RangeFinder.cpp b/libraries/AP_RangeFinder/RangeFinder.cpp index ba7021b1df..477f22b6a9 100644 --- a/libraries/AP_RangeFinder/RangeFinder.cpp +++ b/libraries/AP_RangeFinder/RangeFinder.cpp @@ -676,16 +676,30 @@ void RangeFinder::Log_RFND() if (s == nullptr) { continue; } - - const struct log_RFND pkt = { + if (i == 0) + { + const struct log_RFND pkt = { LOG_PACKET_HEADER_INIT(LOG_RFND_MSG), - time_us : AP_HAL::micros64(), - instance : i, - dist : s->distance_cm(), - status : (uint8_t)s->status(), - orient : s->orientation(), - }; - AP::logger().WriteBlock(&pkt, sizeof(pkt)); + time_us : AP_HAL::micros64(), + instance : i, + dist : s->distance_cm(), + status : (uint8_t)s->status(), + orient : s->orientation(), + }; + AP::logger().WriteBlock(&pkt, sizeof(pkt)); + } + else + { + const struct log_RFND pkt2 = { + LOG_PACKET_HEADER_INIT(LOG_RFND2_MSG), + time_us : AP_HAL::micros64(), + instance : i, + dist : s->distance_cm(), + status : (uint8_t)s->status(), + orient : s->orientation(), + }; + AP::logger().WriteBlock(&pkt2, sizeof(pkt2)); + } } } diff --git a/modules/mavlink b/modules/mavlink index ca507c39ff..18cab69509 160000 --- a/modules/mavlink +++ b/modules/mavlink @@ -1 +1 @@ -Subproject commit ca507c39ff56b88ce78a072a691e4b0c2a95f527 +Subproject commit 18cab6950986cd7b9b7a507ec35f3501d4a7e019