From 42ce9eb6927752932c689f15821188817bf5d209 Mon Sep 17 00:00:00 2001 From: Konrad Date: Mon, 18 Sep 2023 11:26:31 +0200 Subject: [PATCH] mavlink_mission: Send MISSION_CURRENT periodically even when no mission is loaded. --- src/modules/mavlink/mavlink_mission.cpp | 6 +++--- src/modules/mavlink/mavlink_mission.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index f3ec4d55e810..bc0ed3d0734c 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -256,6 +256,7 @@ MavlinkMissionManager::send_mission_current(uint16_t seq) { mavlink_mission_current_t wpc{}; wpc.seq = seq; + wpc.total = _count[MAV_MISSION_TYPE_MISSION] > 0 ? _count[MAV_MISSION_TYPE_MISSION] : UINT16_MAX; wpc.mission_id = _crc32[MAV_MISSION_TYPE_MISSION]; wpc.fence_id = _crc32[MAV_MISSION_TYPE_FENCE]; wpc.rally_points_id = _crc32[MAV_MISSION_TYPE_RALLY]; @@ -516,10 +517,9 @@ MavlinkMissionManager::send() } } else if (_slow_rate_limiter.check(hrt_absolute_time())) { - if ((_count[MAV_MISSION_TYPE_MISSION] > 0) && (_current_seq >= 0)) { - - send_mission_current(_current_seq); + send_mission_current(_current_seq); + if ((_count[MAV_MISSION_TYPE_MISSION] > 0) && (_current_seq >= 0)) { // send the reached message another 10 times if (_last_reached >= 0 && (_reached_sent_count < 10)) { send_mission_item_reached((uint16_t)_last_reached); diff --git a/src/modules/mavlink/mavlink_mission.h b/src/modules/mavlink/mavlink_mission.h index 0a98ea80f892..971787a54734 100644 --- a/src/modules/mavlink/mavlink_mission.h +++ b/src/modules/mavlink/mavlink_mission.h @@ -140,7 +140,7 @@ class MavlinkMissionManager int32_t _land_start_marker{-1}; ///< index of loaded land start mission item (if unavailable, index of land mission item, -1 otherwise) int32_t _land_marker{-1}; ///< index of loaded land mission item (-1 if unavailable) - MavlinkRateLimiter _slow_rate_limiter{100 * 1000}; ///< Rate limit sending of the current WP sequence to 10 Hz + MavlinkRateLimiter _slow_rate_limiter{1000 * 1000}; ///< Rate limit sending of the current WP sequence to 1 Hz Mavlink *_mavlink;