From ee8030de564668050aefab000ac1d129cd00faa1 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Fri, 19 Jul 2024 17:11:13 +0200 Subject: [PATCH] Commander: do not switch out of Terminte after disarm Signed-off-by: Silvan Fuhrer --- src/modules/commander/UserModeIntention.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/UserModeIntention.cpp b/src/modules/commander/UserModeIntention.cpp index 9bb3d08407f9..ac56b9f78225 100644 --- a/src/modules/commander/UserModeIntention.cpp +++ b/src/modules/commander/UserModeIntention.cpp @@ -73,7 +73,10 @@ bool UserModeIntention::change(uint8_t user_intended_nav_state, ModeChangeSource _had_mode_change = true; _user_intented_nav_state = user_intended_nav_state; - if (!_health_and_arming_checks.modePreventsArming(user_intended_nav_state)) { + // Special case termination state: even though this mode prevents arming, + // still don't switch out of it after disarm and thus store it in _nav_state_after_disarming. + if (!_health_and_arming_checks.modePreventsArming(user_intended_nav_state) + || user_intended_nav_state == vehicle_status_s::NAVIGATION_STATE_TERMINATION) { _nav_state_after_disarming = user_intended_nav_state; }