mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
Allow the HUD & AHI to be offset from the OSD page
This commit is contained in:
parent
02dfffc354
commit
2c121b7325
4 changed files with 63 additions and 31 deletions
|
@ -3018,6 +3018,12 @@
|
|||
"osd_crosshairs_style": {
|
||||
"message" : "Crosshairs Style"
|
||||
},
|
||||
"osd_horizon_offset": {
|
||||
"message" : "AHI & HUD offset"
|
||||
},
|
||||
"osd_horizon_offset_help" : {
|
||||
"message" : "Move the HUD and AHI up or down on the OSD to get it level with the actual horizon. The AHI can appear high or low depending on the camera angle in flight. <span style='color:red;'>NOTE: </span> This does not work with the Pixel OSD. For that use the `osd_ahi_vertical_offset` command in the CLI."
|
||||
},
|
||||
"osd_left_sidebar_scroll": {
|
||||
"message" : "Left Sidebar Scroll"
|
||||
},
|
||||
|
|
|
@ -3,6 +3,24 @@
|
|||
var Settings = (function () {
|
||||
let self = {};
|
||||
|
||||
self.fillSelectOption = function(s, ii) {
|
||||
var name = (s.setting.table ? s.setting.table.values[ii] : null);
|
||||
if (name) {
|
||||
var localizedName = chrome.i18n.getMessage(name);
|
||||
if (localizedName) {
|
||||
name = localizedName;
|
||||
}
|
||||
} else {
|
||||
// Fallback to the number itself
|
||||
name = ii;
|
||||
}
|
||||
var option = $('<option/>').attr('value', ii).text(name);
|
||||
if (ii == s.value) {
|
||||
option.prop('selected', true);
|
||||
}
|
||||
return option;
|
||||
}
|
||||
|
||||
self.configureInputs = function() {
|
||||
var inputs = [];
|
||||
$('[data-setting!=""][data-setting]').each(function() {
|
||||
|
@ -45,24 +63,23 @@ var Settings = (function () {
|
|||
input.prop('checked', s.value > 0);
|
||||
} else {
|
||||
input.empty();
|
||||
for (var ii = s.setting.min; ii <= s.setting.max; ii++) {
|
||||
var name = (s.setting.table ? s.setting.table.values[ii] : null);
|
||||
if (name) {
|
||||
var localizedName = chrome.i18n.getMessage(name);
|
||||
if (localizedName) {
|
||||
name = localizedName;
|
||||
let option = null;
|
||||
if (input.data('invert-select') === true) {
|
||||
for (var ii = s.setting.max; ii >= s.setting.min; ii--) {
|
||||
option = null;
|
||||
option = self.fillSelectOption(s, ii);
|
||||
|
||||
option.appendTo(input);
|
||||
}
|
||||
} else {
|
||||
// Fallback to the number itself
|
||||
name = ii;
|
||||
}
|
||||
var option = $('<option/>').attr('value', ii).text(name);
|
||||
if (ii == s.value) {
|
||||
option.prop('selected', true);
|
||||
}
|
||||
for (var ii = s.setting.min; ii <= s.setting.max; ii++) {
|
||||
option = null;
|
||||
option = self.fillSelectOption(s, ii);
|
||||
|
||||
option.appendTo(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (s.setting.type == 'string') {
|
||||
input.val(s.value);
|
||||
input.attr('maxlength', s.setting.max);
|
||||
|
|
|
@ -93,6 +93,11 @@
|
|||
<select class="update_preview" data-setting="osd_crosshairs_style" data-live="true"></select>
|
||||
<span data-i18n="osd_crosshairs_style"></span>
|
||||
</label>
|
||||
<div for="osd_horizon_offset" class="helpicon cf_tip" data-i18n_title="osd_horizon_offset_help"></div>
|
||||
<label>
|
||||
<select class="update_preview" id="osd_horizon_offset" data-setting="osd_horizon_offset" data-live="true"></select>
|
||||
<span data-i18n="osd_horizon_offset"></span>
|
||||
</label>
|
||||
<label>
|
||||
<select class="update_preview" data-setting="osd_left_sidebar_scroll" data-live="true"></select>
|
||||
<span data-i18n="osd_left_sidebar_scroll"></span>
|
||||
|
|
38
tabs/osd.js
38
tabs/osd.js
|
@ -111,6 +111,8 @@ SYM.AH_AIRCRAFT4 = 0x1A6;
|
|||
|
||||
SYM.AH_CROSSHAIRS = new Array(0x166, 0x1A4, new Array(0x190, 0x191, 0x192), new Array(0x193, 0x194, 0x195), new Array(0x196, 0x197, 0x198), new Array(0x199, 0x19A, 0x19B), new Array (0x19C, 0x19D, 0x19E), new Array (0x19F, 0x1A0, 0x1A1));
|
||||
|
||||
var video_type = null;
|
||||
|
||||
var FONT = FONT || {};
|
||||
|
||||
FONT.initData = function () {
|
||||
|
@ -1971,7 +1973,7 @@ OSD.updateSelectedLayout = function(new_layout) {
|
|||
};
|
||||
|
||||
OSD.updateDisplaySize = function () {
|
||||
var video_type = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system];
|
||||
video_type = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system];
|
||||
if (video_type == 'AUTO') {
|
||||
video_type = 'PAL';
|
||||
}
|
||||
|
@ -2674,10 +2676,12 @@ OSD.GUI.updatePreviews = function() {
|
|||
centerPosition += OSD.data.display_size.x / 2;
|
||||
}
|
||||
|
||||
let hudCenterPosition = centerPosition + (OSD.constants.VIDEO_COLS[video_type] * $('#osd_horizon_offset').val());
|
||||
|
||||
// artificial horizon
|
||||
if ($('input[name="ARTIFICIAL_HORIZON"]').prop('checked')) {
|
||||
for (i = 0; i < 9; i++) {
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 4 + i, SYM.AH_BAR9_0 + 4);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 4 + i, SYM.AH_BAR9_0 + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2686,21 +2690,21 @@ OSD.GUI.updatePreviews = function() {
|
|||
crsHNumber = Settings.getInputValue('osd_crosshairs_style');
|
||||
if (crsHNumber == 1) {
|
||||
// AIRCRAFT style
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 2, SYM.AH_AIRCRAFT0);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_AIRCRAFT1);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_AIRCRAFT2);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_AIRCRAFT3);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 2, SYM.AH_AIRCRAFT4);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 2, SYM.AH_AIRCRAFT0);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_AIRCRAFT1);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_AIRCRAFT2);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_AIRCRAFT3);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 2, SYM.AH_AIRCRAFT4);
|
||||
} else if ((crsHNumber > 1) && (crsHNumber < 8)) {
|
||||
// TYPES 3 to 8 (zero indexed)
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
||||
} else {
|
||||
// DEFAULT or unknown style
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CENTER_LINE);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_CENTER_LINE);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2709,12 +2713,12 @@ OSD.GUI.updatePreviews = function() {
|
|||
var hudwidth = OSD.constants.AHISIDEBARWIDTHPOSITION;
|
||||
var hudheight = OSD.constants.AHISIDEBARHEIGHTPOSITION;
|
||||
for (i = -hudheight; i <= hudheight; i++) {
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
}
|
||||
// AH level indicators
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - hudwidth + 1, SYM.AH_LEFT);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + hudwidth - 1, SYM.AH_RIGHT);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - hudwidth + 1, SYM.AH_LEFT);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + hudwidth - 1, SYM.AH_RIGHT);
|
||||
}
|
||||
|
||||
OSD.GUI.updateMapPreview(centerPosition, 'MAP_NORTH', 'N', SYM.HOME);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue