From 04099ed483ed13b19d967c59e3c63cee88c62e29 Mon Sep 17 00:00:00 2001 From: Konrad Date: Fri, 8 Mar 2024 09:44:42 +0100 Subject: [PATCH] mission_base: Force mission validity check on activation --- src/modules/navigator/mission_base.cpp | 12 +++++++----- src/modules/navigator/mission_base.h | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/navigator/mission_base.cpp b/src/modules/navigator/mission_base.cpp index 1d98a03378..495639ba33 100644 --- a/src/modules/navigator/mission_base.cpp +++ b/src/modules/navigator/mission_base.cpp @@ -207,7 +207,7 @@ MissionBase::on_activation() _mission_has_been_activated = true; _system_disarmed_while_inactive = false; - check_mission_valid(); + check_mission_valid(true); update_mission(); @@ -687,11 +687,13 @@ MissionBase::checkMissionRestart() } void -MissionBase::check_mission_valid() +MissionBase::check_mission_valid(bool forced) { - if ((_navigator->get_mission_result()->mission_id != _mission.mission_id) - || (_navigator->get_mission_result()->geofence_id != _mission.geofence_id) - || (_navigator->get_mission_result()->home_position_counter != _navigator->get_home_position()->update_count)) { + // Allow forcing it, since we currently not rechecking if parameters have changed. + if (forced || + (_navigator->get_mission_result()->mission_id != _mission.mission_id) || + (_navigator->get_mission_result()->geofence_id != _mission.geofence_id) || + (_navigator->get_mission_result()->home_position_counter != _navigator->get_home_position()->update_count)) { _navigator->get_mission_result()->mission_id = _mission.mission_id; _navigator->get_mission_result()->geofence_id = _mission.geofence_id; diff --git a/src/modules/navigator/mission_base.h b/src/modules/navigator/mission_base.h index d2275cdabb..3f7e2ce91d 100644 --- a/src/modules/navigator/mission_base.h +++ b/src/modules/navigator/mission_base.h @@ -342,9 +342,10 @@ private: void updateMavlinkMission(); /** - * Check whether a mission is ready to go + * @brief Check whether a mission is ready to go + * @param[in] forced flag if the check has to be run irregardles of any updates. */ - void check_mission_valid(); + void check_mission_valid(bool forced = false); /** * Reset mission