From c7d72821daf1ef06d071439edeb571c457c233e1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 7 Mar 2022 09:30:16 +1100 Subject: [PATCH] AP_RangeFinder: add AP_RANGEFINDER_LEDDARVU8_ENABLED --- libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.cpp | 4 ++++ libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.cpp index 1f791066fc..b903a904f5 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.cpp @@ -15,6 +15,8 @@ #include "AP_RangeFinder_LeddarVu8.h" +#if AP_RANGEFINDER_LEDDARVU8_ENABLED + #include #include @@ -202,3 +204,5 @@ bool AP_RangeFinder_LeddarVu8::parse_byte(uint8_t b, bool &valid_reading, uint16 valid_reading = false; return false; } + +#endif diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.h b/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.h index 75fa8dd67f..78f99f5d4a 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.h +++ b/libraries/AP_RangeFinder/AP_RangeFinder_LeddarVu8.h @@ -3,6 +3,12 @@ #include "AP_RangeFinder.h" #include "AP_RangeFinder_Backend_Serial.h" +#ifndef AP_RANGEFINDER_LEDDARVU8_ENABLED +#define AP_RANGEFINDER_LEDDARVU8_ENABLED 1 +#endif + +#if AP_RANGEFINDER_LEDDARVU8_ENABLED + #define LEDDARVU8_PAYLOAD_LENGTH (8*2) class AP_RangeFinder_LeddarVu8 : public AP_RangeFinder_Backend_Serial @@ -90,3 +96,5 @@ private: uint32_t last_distance_ms; // system time of last successful distance sensor read uint32_t last_distance_request_ms; // system time of last request to sensor to send distances }; + +#endif