From 9b3e267c3a2e38888d719f0662a066598829bf69 Mon Sep 17 00:00:00 2001 From: potaito <3762382+potaito@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:04:11 +0200 Subject: [PATCH] navigator: Fix RTL_TYPE 2 by reloading mission --- src/modules/navigator/rtl.cpp | 6 ++++-- src/modules/navigator/rtl_mission_fast.cpp | 4 ++-- src/modules/navigator/rtl_mission_fast.h | 2 +- src/modules/navigator/rtl_mission_fast_reverse.cpp | 4 ++-- src/modules/navigator/rtl_mission_fast_reverse.h | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modules/navigator/rtl.cpp b/src/modules/navigator/rtl.cpp index e34f242d4ada..f27c112aac2c 100644 --- a/src/modules/navigator/rtl.cpp +++ b/src/modules/navigator/rtl.cpp @@ -585,6 +585,8 @@ void RTL::init_rtl_mission_type() _set_rtl_mission_type = RtlType::NONE; } + mission_s new_mission = _mission_sub.get(); + switch (new_rtl_mission_type) { case RtlType::RTL_DIRECT_MISSION_LAND: _rtl_mission_type_handle = new RtlDirectMissionLand(_navigator); @@ -593,13 +595,13 @@ void RTL::init_rtl_mission_type() break; case RtlType::RTL_MISSION_FAST: - _rtl_mission_type_handle = new RtlMissionFast(_navigator); + _rtl_mission_type_handle = new RtlMissionFast(_navigator, new_mission); _set_rtl_mission_type = RtlType::RTL_MISSION_FAST; _rtl_type = RtlType::RTL_MISSION_FAST; break; case RtlType::RTL_MISSION_FAST_REVERSE: - _rtl_mission_type_handle = new RtlMissionFastReverse(_navigator); + _rtl_mission_type_handle = new RtlMissionFastReverse(_navigator, new_mission); _set_rtl_mission_type = RtlType::RTL_MISSION_FAST_REVERSE; _rtl_type = RtlType::RTL_MISSION_FAST_REVERSE; break; diff --git a/src/modules/navigator/rtl_mission_fast.cpp b/src/modules/navigator/rtl_mission_fast.cpp index d3e07a36ddc3..ccfc91cfde65 100644 --- a/src/modules/navigator/rtl_mission_fast.cpp +++ b/src/modules/navigator/rtl_mission_fast.cpp @@ -46,10 +46,10 @@ static constexpr int32_t DEFAULT_MISSION_FAST_CACHE_SIZE = 5; -RtlMissionFast::RtlMissionFast(Navigator *navigator) : +RtlMissionFast::RtlMissionFast(Navigator *navigator, mission_s mission) : RtlBase(navigator, DEFAULT_MISSION_FAST_CACHE_SIZE) { - + _mission = mission; } void RtlMissionFast::on_inactive() diff --git a/src/modules/navigator/rtl_mission_fast.h b/src/modules/navigator/rtl_mission_fast.h index c782a471bd7a..d1231022b6f1 100644 --- a/src/modules/navigator/rtl_mission_fast.h +++ b/src/modules/navigator/rtl_mission_fast.h @@ -52,7 +52,7 @@ class Navigator; class RtlMissionFast : public RtlBase { public: - RtlMissionFast(Navigator *navigator); + RtlMissionFast(Navigator *navigator, mission_s mission); ~RtlMissionFast() = default; void on_activation() override; diff --git a/src/modules/navigator/rtl_mission_fast_reverse.cpp b/src/modules/navigator/rtl_mission_fast_reverse.cpp index d78f6c7fa627..eb5f3d102246 100644 --- a/src/modules/navigator/rtl_mission_fast_reverse.cpp +++ b/src/modules/navigator/rtl_mission_fast_reverse.cpp @@ -46,10 +46,10 @@ static constexpr int32_t DEFAULT_MISSION_FAST_REVERSE_CACHE_SIZE = 5; -RtlMissionFastReverse::RtlMissionFastReverse(Navigator *navigator) : +RtlMissionFastReverse::RtlMissionFastReverse(Navigator *navigator, mission_s mission) : RtlBase(navigator, -DEFAULT_MISSION_FAST_REVERSE_CACHE_SIZE) { - + _mission = mission; } void RtlMissionFastReverse::on_inactive() diff --git a/src/modules/navigator/rtl_mission_fast_reverse.h b/src/modules/navigator/rtl_mission_fast_reverse.h index 168d20c2e341..9a30e6d70de5 100644 --- a/src/modules/navigator/rtl_mission_fast_reverse.h +++ b/src/modules/navigator/rtl_mission_fast_reverse.h @@ -52,7 +52,7 @@ class Navigator; class RtlMissionFastReverse : public RtlBase { public: - RtlMissionFastReverse(Navigator *navigator); + RtlMissionFastReverse(Navigator *navigator, mission_s mission); ~RtlMissionFastReverse() = default; void on_activation() override;