forked from Archive/PX4-Autopilot
mission_base: make sure to always update state on mission topic update
This commit is contained in:
parent
97ce599b1f
commit
0a153efb9d
|
@ -111,10 +111,8 @@ void MissionBase::updateMavlinkMission()
|
|||
mission_s new_mission;
|
||||
_mission_sub.update(&new_mission);
|
||||
|
||||
if (isMissionValid(new_mission)) {
|
||||
/* Relevant mission items updated externally*/
|
||||
if (checkMissionDataChanged(new_mission)) {
|
||||
bool mission_items_changed = (new_mission.mission_id != _mission.mission_id);
|
||||
const bool mission_items_changed = (new_mission.mission_id != _mission.mission_id);
|
||||
const bool mission_data_changed = checkMissionDataChanged(new_mission);
|
||||
|
||||
if (new_mission.current_seq < 0) {
|
||||
new_mission.current_seq = math::max(math::min(_mission.current_seq, static_cast<int32_t>(new_mission.count) - 1),
|
||||
|
@ -123,11 +121,15 @@ void MissionBase::updateMavlinkMission()
|
|||
|
||||
_mission = new_mission;
|
||||
|
||||
_is_current_planned_mission_item_valid = isMissionValid(_mission);
|
||||
|
||||
/* Relevant mission items updated externally*/
|
||||
if (mission_data_changed) {
|
||||
|
||||
onMissionUpdate(mission_items_changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MissionBase::onMissionUpdate(bool has_mission_items_changed)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue