AP_OSD: make AP_RANGEFINDER_ENABLED remove more code

This commit is contained in:
Peter Barker 2023-11-08 09:23:40 +11:00 committed by Andrew Tridgell
parent 07e76a7cae
commit 37964011df
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include <GCS_MAVLink/GCS_MAVLink.h>
#endif
#include <AC_Fence/AC_Fence_config.h>
#include <AP_RangeFinder/AP_RangeFinder_config.h>
class AP_OSD_Backend;
class AP_MSP;
@ -334,7 +335,9 @@ private:
#if AP_FENCE_ENABLED
void draw_fence(uint8_t x, uint8_t y);
#endif
#if AP_RANGEFINDER_ENABLED
void draw_rngf(uint8_t x, uint8_t y);
#endif
#if AP_OSD_EXTENDED_LNK_STATS
// Extended link stats data panels

View File

@ -2534,6 +2534,7 @@ void AP_OSD_Screen::draw_fence(uint8_t x, uint8_t y)
}
#endif
#if AP_RANGEFINDER_ENABLED
void AP_OSD_Screen::draw_rngf(uint8_t x, uint8_t y)
{
RangeFinder *rangefinder = RangeFinder::get_singleton();
@ -2547,6 +2548,7 @@ void AP_OSD_Screen::draw_rngf(uint8_t x, uint8_t y)
backend->write(x, y, false, "%c%4.1f%c", SYMBOL(SYM_RNGFD), u_scale(DISTANCE, distance), u_icon(DISTANCE));
}
}
#endif
#define DRAW_SETTING(n) if (n.enabled) draw_ ## n(n.xpos, n.ypos)
@ -2572,7 +2574,9 @@ void AP_OSD_Screen::draw(void)
DRAW_SETTING(hgt_abvterr);
#endif
#if AP_RANGEFINDER_ENABLED
DRAW_SETTING(rngf);
#endif
DRAW_SETTING(waypoint);
DRAW_SETTING(xtrack_error);
DRAW_SETTING(bat_volt);