From 28fbc73fb60d50cf236e86cd1ad730f0e28bccb4 Mon Sep 17 00:00:00 2001 From: chobits Date: Tue, 6 Apr 2021 11:22:13 +0800 Subject: [PATCH] Copter: fix build error when landinggear disabled --- ArduCopter/land_detector.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ArduCopter/land_detector.cpp b/ArduCopter/land_detector.cpp index 66caa1bba3..7515f25e1e 100644 --- a/ArduCopter/land_detector.cpp +++ b/ArduCopter/land_detector.cpp @@ -69,10 +69,12 @@ void Copter::update_land_detector() #endif uint8_t land_detector_scalar = 1; +#if LANDING_GEAR_ENABLED == ENABLED if (landinggear.get_wow_state() != AP_LandingGear::LG_WOW_UNKNOWN) { // we have a WoW sensor so lets loosen the strictness of the landing detector land_detector_scalar = 2; } +#endif // check that the airframe is not accelerating (not falling or braking after fast forward flight) bool accel_stationary = (land_accel_ef_filter.get().length() <= LAND_DETECTOR_ACCEL_MAX * land_detector_scalar); @@ -84,7 +86,11 @@ void Copter::update_land_detector() bool rangefinder_check = (!rangefinder_alt_ok() || rangefinder_state.alt_cm_filt.get() < LAND_RANGEFINDER_MIN_ALT_CM); // if we have weight on wheels (WoW) or ambiguous unknown. never no WoW +#if LANDING_GEAR_ENABLED == ENABLED const bool WoW_check = (landinggear.get_wow_state() == AP_LandingGear::LG_WOW || landinggear.get_wow_state() == AP_LandingGear::LG_WOW_UNKNOWN); +#else + const bool WoW_check = true; +#endif if (motor_at_lower_limit && accel_stationary && descent_rate_low && rangefinder_check && WoW_check) { // landed criteria met - increment the counter and check if we've triggered