From 8cff9a1e04711cef67ff524f3433c85d1309ad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 6 May 2022 08:08:07 +0200 Subject: [PATCH] commander: fix incorrect return in set_link_loss_nav_state() If both local position and altitude were not valid, then both RC loss and datalink loss would not trigger any failsafe at all, independently from the configured action. --- src/modules/commander/state_machine_helper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 1e3a66da52..71efd6b83a 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -755,12 +755,13 @@ void set_link_loss_nav_state(vehicle_status_s &status, actuator_armed_s &armed, } else { if (status_flags.local_position_valid) { status.nav_state = vehicle_status_s::NAVIGATION_STATE_AUTO_LAND; + return; } else if (status_flags.local_altitude_valid) { status.nav_state = vehicle_status_s::NAVIGATION_STATE_DESCEND; + return; } - return; } // FALLTHROUGH