From 66dac7a2e3505b390d00445bdc3643e230bd3791 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Sat, 3 Mar 2018 22:46:39 +0000 Subject: [PATCH] Positionable OSD crosshairs and AHI (#5326) * Make Artificial horizon and crosshairs positionable * Remove dependency on AHI for AHI sidebars * Use the old fixed positions as defaults for some OSD elements Namely: - crosshairs - artificial horizon - artificial horizon sidebars --- src/main/io/osd.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 9cc593f6d..a820b7ec9 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -556,11 +556,6 @@ static bool osdDrawSingleElement(uint8_t item) #endif case OSD_CROSSHAIRS: - elemPosX = 14 - 1; // Offset for 1 char to the left - elemPosY = 6; - if (displayScreenSize(osdDisplayPort) == VIDEO_BUFFER_CHARS_PAL) { - ++elemPosY; - } buff[0] = SYM_AH_CENTER_LINE; buff[1] = SYM_AH_CENTER; buff[2] = SYM_AH_CENTER_LINE_RIGHT; @@ -569,12 +564,6 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_ARTIFICIAL_HORIZON: { - elemPosX = 14; - elemPosY = 6 - 4; // Top center of the AH area - if (displayScreenSize(osdDisplayPort) == VIDEO_BUFFER_CHARS_PAL) { - ++elemPosY; - } - // Get pitch and roll limits in tenths of degrees const int maxPitch = osdConfig()->ahMaxPitch * 10; const int maxRoll = osdConfig()->ahMaxRoll * 10; @@ -591,19 +580,11 @@ static bool osdDrawSingleElement(uint8_t item) } } - osdDrawSingleElement(OSD_HORIZON_SIDEBARS); - return true; } case OSD_HORIZON_SIDEBARS: { - elemPosX = 14; - elemPosY = 6; - if (displayScreenSize(osdDisplayPort) == VIDEO_BUFFER_CHARS_PAL) { - ++elemPosY; - } - // Draw AH sides const int8_t hudwidth = AH_SIDEBAR_WIDTH_POS; const int8_t hudheight = AH_SIDEBAR_HEIGHT_POS; @@ -815,6 +796,7 @@ static void osdDrawElements(void) osdDrawSingleElement(OSD_MAIN_BATT_VOLTAGE); osdDrawSingleElement(OSD_RSSI_VALUE); osdDrawSingleElement(OSD_CROSSHAIRS); + osdDrawSingleElement(OSD_HORIZON_SIDEBARS); osdDrawSingleElement(OSD_ITEM_TIMER_1); osdDrawSingleElement(OSD_ITEM_TIMER_2); osdDrawSingleElement(OSD_REMAINING_TIME_ESTIMATE); @@ -882,6 +864,11 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig) // Always enable warnings elements by default osdConfig->item_pos[OSD_WARNINGS] = OSD_POS(9, 10) | VISIBLE_FLAG; + // Default to old fixed positions for these elements + osdConfig->item_pos[OSD_CROSSHAIRS] = OSD_POS(13, 6); + osdConfig->item_pos[OSD_ARTIFICIAL_HORIZON] = OSD_POS(14, 2); + osdConfig->item_pos[OSD_HORIZON_SIDEBARS] = OSD_POS(14, 6); + osdConfig->enabled_stats[OSD_STAT_MAX_SPEED] = true; osdConfig->enabled_stats[OSD_STAT_MIN_BATTERY] = true; osdConfig->enabled_stats[OSD_STAT_MIN_RSSI] = true;