From 1bf3765786feeeb988edde7090def60af18be9b5 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 15 May 2022 16:08:03 +0200 Subject: [PATCH] Fix building when terrain not available --- ArduPlane/mode_rtl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ArduPlane/mode_rtl.cpp b/ArduPlane/mode_rtl.cpp index c9ba1bc9a0..637c0595da 100644 --- a/ArduPlane/mode_rtl.cpp +++ b/ArduPlane/mode_rtl.cpp @@ -70,7 +70,9 @@ void ModeRTL::update() plane.calc_throttle(); float altitude = plane.relative_altitude; +#if AP_TERRAIN_AVAILABLE if (!plane.terrain_disabled()) plane.terrain.height_above_terrain(altitude, true); +#endif if (plane.rtl.emergency_landing_status >= Plane::FSEmergencyLandingStatus::GLIDING && (plane.g.fs_emergency_landing_land_upwind || (plane.g.fs_emergency_landing_leveling_altitude > -1 && altitude < plane.g.fs_emergency_landing_leveling_altitude.get()))) { @@ -208,7 +210,9 @@ void ModeRTL::navigate() case Plane::FSEmergencyLandingStatus::GLIDING: { plane.set_auto_thr_gliding(true); float altitude = plane.relative_altitude; +#if AP_TERRAIN_AVAILABLE if (!plane.terrain_disabled()) plane.terrain.height_above_terrain(altitude, true); +#endif if (altitude < 10) { // below 10m don't go back to home altitude if FS ends