From 6e5198a50c8db98759440331283819a1882a1691 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 26 Jun 2024 12:05:29 +1000 Subject: [PATCH] AP_Frsky_Telem: make AP_RANGEFINDER_ENABLED remove more code --- libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp index db60fa4048..ec883049f1 100644 --- a/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp +++ b/libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp @@ -683,7 +683,9 @@ uint32_t AP_Frsky_SPort_Passthrough::calc_velandyaw(void) */ uint32_t AP_Frsky_SPort_Passthrough::calc_attiandrng(void) { +#if AP_RANGEFINDER_ENABLED const RangeFinder *_rng = RangeFinder::get_singleton(); +#endif float roll; float pitch; @@ -693,7 +695,11 @@ uint32_t AP_Frsky_SPort_Passthrough::calc_attiandrng(void) // pitch from [-9000;9000] centidegrees to unsigned .2 degree increments [0;900] (just in case, limit to 1023 (0x3FF) since the value is stored on 10 bits) attiandrng |= ((uint16_t)roundf((pitch * RAD_TO_DEG * 100 + 9000) * 0.05f) & ATTIANDRNG_PITCH_LIMIT)<distance_cm_orient(ROTATION_PITCH_270) : 0, 3, 1)<