AP_OSD: Add option to disable Crosshair on horizon element

This commit is contained in:
giacomo892 2021-07-28 10:56:02 +02:00 committed by Andrew Tridgell
parent 9ab0d2e387
commit 8da8b34b49
3 changed files with 8 additions and 3 deletions

View File

@ -82,7 +82,7 @@ const AP_Param::GroupInfo AP_OSD::var_info[] = {
// @Param: _OPTIONS
// @DisplayName: OSD Options
// @Description: This sets options that change the display
// @Bitmask: 0:UseDecimalPack, 1:InvertedWindPointer, 2:InvertedAHRoll, 3:Convert feet to miles at 5280ft instead of 10000ft
// @Bitmask: 0:UseDecimalPack, 1:InvertedWindPointer, 2:InvertedAHRoll, 3:Convert feet to miles at 5280ft instead of 10000ft, 4:DisableCrosshair
// @User: Standard
AP_GROUPINFO("_OPTIONS", 8, AP_OSD, options, OPTION_DECIMAL_PACK),

View File

@ -476,6 +476,7 @@ public:
OPTION_INVERTED_WIND = 1U<<1,
OPTION_INVERTED_AH_ROLL = 1U<<2,
OPTION_IMPERIAL_MILES = 1U<<3,
OPTION_DISABLE_CROSSHAIR = 1U<<4,
};
enum {

View File

@ -1265,7 +1265,7 @@ void AP_OSD_Screen::draw_avgcellvolt(uint8_t x, uint8_t y)
// calculate cell count - WARNING this can be inaccurate if the LIPO/LIION battery is far from fully charged when attached and is used in this panel
osd->max_battery_voltage = MAX(osd->max_battery_voltage,v);
if (osd->cell_count > 0) {
v = v / osd->cell_count;
v = v / osd->cell_count;
backend->write(x,y, v < osd->warn_avgcellvolt, "%c%1.2f%c", SYM_BATT_FULL + p, v, SYM_VOLT);
} else if (osd->cell_count < 0) { // user must decide on autodetect cell count or manually entered to display this panel since default is -1
backend->write(x,y, false, "%c---%c", SYM_BATT_FULL + p, SYM_VOLT);
@ -1495,7 +1495,11 @@ void AP_OSD_Screen::draw_horizon(uint8_t x, uint8_t y)
}
}
}
backend->write(x-1,y, false, "%c%c%c", SYM_AH_CENTER_LINE_LEFT, SYM_AH_CENTER, SYM_AH_CENTER_LINE_RIGHT);
if (!check_option(AP_OSD::OPTION_DISABLE_CROSSHAIR)) {
backend->write(x-1,y, false, "%c%c%c", SYM_AH_CENTER_LINE_LEFT, SYM_AH_CENTER, SYM_AH_CENTER_LINE_RIGHT);
}
}
void AP_OSD_Screen::draw_distance(uint8_t x, uint8_t y, float distance)