Commander: do not switch out of Terminte after disarm

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2024-07-19 17:11:13 +02:00
parent 0b1eba948a
commit ee8030de56
+4 -1
View File
@@ -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;
}