mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user