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
This commit is contained in:
Dan Nixon 2018-03-03 22:46:39 +00:00 committed by Michael Keller
parent 3855d254b0
commit 66dac7a2e3
1 changed files with 6 additions and 19 deletions

View File

@ -556,11 +556,6 @@ static bool osdDrawSingleElement(uint8_t item)
#endif #endif
case OSD_CROSSHAIRS: 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[0] = SYM_AH_CENTER_LINE;
buff[1] = SYM_AH_CENTER; buff[1] = SYM_AH_CENTER;
buff[2] = SYM_AH_CENTER_LINE_RIGHT; buff[2] = SYM_AH_CENTER_LINE_RIGHT;
@ -569,12 +564,6 @@ static bool osdDrawSingleElement(uint8_t item)
case OSD_ARTIFICIAL_HORIZON: 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 // Get pitch and roll limits in tenths of degrees
const int maxPitch = osdConfig()->ahMaxPitch * 10; const int maxPitch = osdConfig()->ahMaxPitch * 10;
const int maxRoll = osdConfig()->ahMaxRoll * 10; const int maxRoll = osdConfig()->ahMaxRoll * 10;
@ -591,19 +580,11 @@ static bool osdDrawSingleElement(uint8_t item)
} }
} }
osdDrawSingleElement(OSD_HORIZON_SIDEBARS);
return true; return true;
} }
case OSD_HORIZON_SIDEBARS: case OSD_HORIZON_SIDEBARS:
{ {
elemPosX = 14;
elemPosY = 6;
if (displayScreenSize(osdDisplayPort) == VIDEO_BUFFER_CHARS_PAL) {
++elemPosY;
}
// Draw AH sides // Draw AH sides
const int8_t hudwidth = AH_SIDEBAR_WIDTH_POS; const int8_t hudwidth = AH_SIDEBAR_WIDTH_POS;
const int8_t hudheight = AH_SIDEBAR_HEIGHT_POS; const int8_t hudheight = AH_SIDEBAR_HEIGHT_POS;
@ -815,6 +796,7 @@ static void osdDrawElements(void)
osdDrawSingleElement(OSD_MAIN_BATT_VOLTAGE); osdDrawSingleElement(OSD_MAIN_BATT_VOLTAGE);
osdDrawSingleElement(OSD_RSSI_VALUE); osdDrawSingleElement(OSD_RSSI_VALUE);
osdDrawSingleElement(OSD_CROSSHAIRS); osdDrawSingleElement(OSD_CROSSHAIRS);
osdDrawSingleElement(OSD_HORIZON_SIDEBARS);
osdDrawSingleElement(OSD_ITEM_TIMER_1); osdDrawSingleElement(OSD_ITEM_TIMER_1);
osdDrawSingleElement(OSD_ITEM_TIMER_2); osdDrawSingleElement(OSD_ITEM_TIMER_2);
osdDrawSingleElement(OSD_REMAINING_TIME_ESTIMATE); osdDrawSingleElement(OSD_REMAINING_TIME_ESTIMATE);
@ -882,6 +864,11 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
// Always enable warnings elements by default // Always enable warnings elements by default
osdConfig->item_pos[OSD_WARNINGS] = OSD_POS(9, 10) | VISIBLE_FLAG; 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_MAX_SPEED] = true;
osdConfig->enabled_stats[OSD_STAT_MIN_BATTERY] = true; osdConfig->enabled_stats[OSD_STAT_MIN_BATTERY] = true;
osdConfig->enabled_stats[OSD_STAT_MIN_RSSI] = true; osdConfig->enabled_stats[OSD_STAT_MIN_RSSI] = true;