Plane: Pass external HAGL to TECS

This commit is contained in:
George Zogopoulos 2024-12-05 11:54:23 +01:00 committed by Peter Barker
parent 70fe304c7e
commit 4c335e89a0
1 changed files with 9 additions and 0 deletions

View File

@ -789,7 +789,16 @@ float Plane::tecs_hgt_afe(void)
coming. coming.
*/ */
float hgt_afe; float hgt_afe;
if (flight_stage == AP_FixedWing::FlightStage::LAND) { 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(); hgt_afe = height_above_target();
#if AP_RANGEFINDER_ENABLED #if AP_RANGEFINDER_ENABLED
hgt_afe -= rangefinder_correction(); hgt_afe -= rangefinder_correction();