From 2818151a3988013a3db72ebf55efb249be1f0a82 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 24 Oct 2019 22:35:19 +1100 Subject: [PATCH] AP_RangeFinder: disable some incompatible drivers for AP_Periph --- libraries/AP_RangeFinder/RangeFinder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/AP_RangeFinder/RangeFinder.cpp b/libraries/AP_RangeFinder/RangeFinder.cpp index 5b936f1900..9e9763924e 100644 --- a/libraries/AP_RangeFinder/RangeFinder.cpp +++ b/libraries/AP_RangeFinder/RangeFinder.cpp @@ -431,11 +431,13 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance) break; #if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS case RangeFinder_TYPE_PX4_PWM: +#ifndef HAL_BUILD_AP_PERIPH // to ease moving from PX4 to ChibiOS we'll lie a little about // the backend driver... if (AP_RangeFinder_PWM::detect()) { drivers[instance] = new AP_RangeFinder_PWM(state[instance], params[instance], estimated_terrain_height); } +#endif break; #endif #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI @@ -469,9 +471,11 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance) break; #endif case RangeFinder_TYPE_MAVLink: +#ifndef HAL_BUILD_AP_PERIPH if (AP_RangeFinder_MAVLink::detect()) { drivers[instance] = new AP_RangeFinder_MAVLink(state[instance], params[instance]); } +#endif break; case RangeFinder_TYPE_MBSER: if (AP_RangeFinder_MaxsonarSerialLV::detect(serial_instance)) { @@ -479,10 +483,12 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance) } break; case RangeFinder_TYPE_ANALOG: +#ifndef HAL_BUILD_AP_PERIPH // note that analog will always come back as present if the pin is valid if (AP_RangeFinder_analog::detect(params[instance])) { drivers[instance] = new AP_RangeFinder_analog(state[instance], params[instance]); } +#endif break; case RangeFinder_TYPE_NMEA: if (AP_RangeFinder_NMEA::detect(serial_instance)) { @@ -510,9 +516,11 @@ void RangeFinder::detect_instance(uint8_t instance, uint8_t& serial_instance) } break; case RangeFinder_TYPE_PWM: +#ifndef HAL_BUILD_AP_PERIPH if (AP_RangeFinder_PWM::detect()) { drivers[instance] = new AP_RangeFinder_PWM(state[instance], params[instance], estimated_terrain_height); } +#endif break; case RangeFinder_TYPE_BLPing: if (AP_RangeFinder_BLPing::detect(serial_instance)) {