From 843cb05ef4ee9cfffe5e35e27a8e28132487aeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 29 Jun 2017 11:16:30 +0200 Subject: [PATCH] mavlink_mission: fix send_mission_count: must always use MAV_MISSION_TYPE_MISSION Because it's only used for missions --- src/modules/mavlink/mavlink_mission.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index 4da4e2d8ce..9b3ec703b3 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -273,14 +273,16 @@ MavlinkMissionManager::send_mission_ack(uint8_t sysid, uint8_t compid, uint8_t t void MavlinkMissionManager::send_mission_current(uint16_t seq) { - if (seq < current_item_count()) { + unsigned item_count = _count[(uint8_t)MAV_MISSION_TYPE_MISSION]; + + if (seq < item_count) { mavlink_mission_current_t wpc; wpc.seq = seq; mavlink_msg_mission_current_send_struct(_mavlink->get_channel(), &wpc); - } else if (seq == 0 && current_item_count() == 0) { + } else if (seq == 0 && item_count == 0) { /* don't broadcast if no WPs */ } else {