diff --git a/src/modules/navigator/rtl_direct.cpp b/src/modules/navigator/rtl_direct.cpp index 63c876b3c5f8..ebf2ef4728ad 100644 --- a/src/modules/navigator/rtl_direct.cpp +++ b/src/modules/navigator/rtl_direct.cpp @@ -324,19 +324,21 @@ void RtlDirect::set_rtl_item() startPrecLand(_mission_item.land_precision); - _rtl_state = RTLState::IDLE; + _rtl_state = RTLState::COMPLETED; mavlink_log_info(_navigator->get_mavlink_log_pub(), "RTL: land at destination\t"); events::send(events::ID("rtl_land_at_destination"), events::Log::Info, "RTL: land at destination"); break; } - case RTLState::IDLE: { + case RTLState::COMPLETED: { set_idle_item(&_mission_item); _navigator->mode_completed(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL); + _rtl_state = RTLState::IDLE; break; } + case RTLState::IDLE: default: break; } @@ -489,6 +491,7 @@ rtl_time_estimate_s RtlDirect::calc_rtl_time_estimate() break; + case RTLState::COMPLETED: case RTLState::IDLE: // Remaining time is 0 break; diff --git a/src/modules/navigator/rtl_direct.h b/src/modules/navigator/rtl_direct.h index 3a5597d4ad52..669ec1fd95b6 100644 --- a/src/modules/navigator/rtl_direct.h +++ b/src/modules/navigator/rtl_direct.h @@ -115,6 +115,7 @@ class RtlDirect : public MissionBlock, public ModuleParams TRANSITION_TO_MC, MOVE_TO_LAND_HOVER, LAND, + COMPLETED, IDLE } _rtl_state{RTLState::IDLE}; /*< Current state in the state machine.*/