From 4c335e89a0f8830c23f375eb10e8cf9d0d0760d8 Mon Sep 17 00:00:00 2001 From: George Zogopoulos Date: Thu, 5 Dec 2024 11:54:23 +0100 Subject: [PATCH] Plane: Pass external HAGL to TECS --- ArduPlane/ArduPlane.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index 7d27791de5..1f6d0c6159 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -789,7 +789,16 @@ float Plane::tecs_hgt_afe(void) coming. */ float hgt_afe; + if (flight_stage == AP_FixedWing::FlightStage::LAND) { + + #if AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED + // if external HAGL is active use that + if (get_external_HAGL(hgt_afe)) { + return hgt_afe; + } + #endif + hgt_afe = height_above_target(); #if AP_RANGEFINDER_ENABLED hgt_afe -= rangefinder_correction();