diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.cpp index a54b6b0b2e..309d119e41 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.cpp @@ -16,33 +16,6 @@ #include "AP_RangeFinder_MAVLink.h" #include - - -extern const AP_HAL::HAL& hal; - -/* - The constructor also initialises the rangefinder. Note that this - constructor is not called until detect() returns true, so we - already know that we should setup the rangefinder -*/ -AP_RangeFinder_MAVLink::AP_RangeFinder_MAVLink(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params) : - AP_RangeFinder_Backend(_state, _params) -{ - state.last_reading_ms = AP_HAL::millis(); - distance_cm = 0; -} - -/* - detect if a MAVLink rangefinder is connected. We'll detect by - checking a parameter. -*/ -bool AP_RangeFinder_MAVLink::detect() -{ - // Assume that if the user set the RANGEFINDER_TYPE parameter to MAVLink, - // there is an attached MAVLink rangefinder - return true; -} - /* Set the distance based on a MAVLINK message */ diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.h b/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.h index 2d6a711b0f..52728b3a7c 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.h +++ b/libraries/AP_RangeFinder/AP_RangeFinder_MAVLink.h @@ -11,10 +11,11 @@ class AP_RangeFinder_MAVLink : public AP_RangeFinder_Backend public: // constructor - AP_RangeFinder_MAVLink(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params); + using AP_RangeFinder_Backend::AP_RangeFinder_Backend; - // static detection function - static bool detect(); + // Assume that if the user set the RANGEFINDER_TYPE parameter to MAVLink, + // there is an attached MAVLink rangefinder + static bool detect() { return true; } // update state void update(void) override;