Skip to content

Commit

Permalink
mavlink-mission: Initialize the safepoint and mission counter from th…
Browse files Browse the repository at this point in the history
…e 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.
  • Loading branch information
KonradRudin authored and pussuw committed Dec 12, 2023
1 parent 2bfb214 commit ea99c65
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/mavlink/mavlink_mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ea99c65

Please sign in to comment.