From e4111a03bf4174781843a23462dcec45e92d62b7 Mon Sep 17 00:00:00 2001 From: Konrad Date: Wed, 26 Jul 2023 16:15:42 +0200 Subject: [PATCH] mavlink-mission: Initialize the safepoint and mission counter from the dataman state. If at the last powercycle one mission was uploaded, the counter in dataman was 1. On the next powercycle the mavlink mission counter was reset to zero and on first mission upload updated to 1 again. Other modules check, if the mission was changed based on the counter, like the mission.cpp loaded the mission counter from the dataman. On a new mission, the comparison of the counters failed, because both were the same value even if the mission was completely different. --- src/modules/mavlink/mavlink_mission.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index b0230f792c..b20480e791 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -92,6 +92,7 @@ MavlinkMissionManager::init_offboard_mission() _dataman_id = (dm_item_t)mission_state.dataman_id; _count[MAV_MISSION_TYPE_MISSION] = mission_state.count; _current_seq = mission_state.current_seq; + _mission_update_counter = mission_state.mission_update_counter; } else { PX4_WARN("offboard mission init failed"); @@ -131,6 +132,7 @@ MavlinkMissionManager::load_safepoint_stats() if (success) { _count[MAV_MISSION_TYPE_RALLY] = stats.num_items; + _safepoint_update_counter = stats.update_counter; } return success;