From 2fa6f534abd8ee01739403d3999bfee2eba2e4a5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 25 Jan 2020 10:58:15 +1100 Subject: [PATCH] AP_RangeFinder: added get_type() API --- libraries/AP_RangeFinder/AP_RangeFinder.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_RangeFinder/AP_RangeFinder.h b/libraries/AP_RangeFinder/AP_RangeFinder.h index 675c7a00be..5a9831b6b4 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder.h +++ b/libraries/AP_RangeFinder/AP_RangeFinder.h @@ -139,6 +139,11 @@ public: AP_RangeFinder_Backend *get_backend(uint8_t id) const; + // get rangefinder type for an ID + Type get_type(uint8_t id) const { + return id >= RANGEFINDER_MAX_INSTANCES? Type::NONE : Type(params[id].type.get()); + } + // methods to return a distance on a particular orientation from // any sensor which can current supply it uint16_t distance_cm_orient(enum Rotation orientation) const;