mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 03:49:53 +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": {
|
"osd_crosshairs_style": {
|
||||||
"message" : "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": {
|
"osd_left_sidebar_scroll": {
|
||||||
"message" : "Left Sidebar Scroll"
|
"message" : "Left Sidebar Scroll"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,24 @@
|
||||||
var Settings = (function () {
|
var Settings = (function () {
|
||||||
let self = {};
|
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() {
|
self.configureInputs = function() {
|
||||||
var inputs = [];
|
var inputs = [];
|
||||||
$('[data-setting!=""][data-setting]').each(function() {
|
$('[data-setting!=""][data-setting]').each(function() {
|
||||||
|
@ -45,22 +63,21 @@ var Settings = (function () {
|
||||||
input.prop('checked', s.value > 0);
|
input.prop('checked', s.value > 0);
|
||||||
} else {
|
} else {
|
||||||
input.empty();
|
input.empty();
|
||||||
for (var ii = s.setting.min; ii <= s.setting.max; ii++) {
|
let option = null;
|
||||||
var name = (s.setting.table ? s.setting.table.values[ii] : null);
|
if (input.data('invert-select') === true) {
|
||||||
if (name) {
|
for (var ii = s.setting.max; ii >= s.setting.min; ii--) {
|
||||||
var localizedName = chrome.i18n.getMessage(name);
|
option = null;
|
||||||
if (localizedName) {
|
option = self.fillSelectOption(s, ii);
|
||||||
name = localizedName;
|
|
||||||
}
|
option.appendTo(input);
|
||||||
} else {
|
|
||||||
// Fallback to the number itself
|
|
||||||
name = ii;
|
|
||||||
}
|
}
|
||||||
var option = $('<option/>').attr('value', ii).text(name);
|
} else {
|
||||||
if (ii == s.value) {
|
for (var ii = s.setting.min; ii <= s.setting.max; ii++) {
|
||||||
option.prop('selected', true);
|
option = null;
|
||||||
|
option = self.fillSelectOption(s, ii);
|
||||||
|
|
||||||
|
option.appendTo(input);
|
||||||
}
|
}
|
||||||
option.appendTo(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s.setting.type == 'string') {
|
} else if (s.setting.type == 'string') {
|
||||||
|
|
|
@ -93,6 +93,11 @@
|
||||||
<select class="update_preview" data-setting="osd_crosshairs_style" data-live="true"></select>
|
<select class="update_preview" data-setting="osd_crosshairs_style" data-live="true"></select>
|
||||||
<span data-i18n="osd_crosshairs_style"></span>
|
<span data-i18n="osd_crosshairs_style"></span>
|
||||||
</label>
|
</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>
|
<label>
|
||||||
<select class="update_preview" data-setting="osd_left_sidebar_scroll" data-live="true"></select>
|
<select class="update_preview" data-setting="osd_left_sidebar_scroll" data-live="true"></select>
|
||||||
<span data-i18n="osd_left_sidebar_scroll"></span>
|
<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));
|
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 || {};
|
var FONT = FONT || {};
|
||||||
|
|
||||||
FONT.initData = function () {
|
FONT.initData = function () {
|
||||||
|
@ -1971,7 +1973,7 @@ OSD.updateSelectedLayout = function(new_layout) {
|
||||||
};
|
};
|
||||||
|
|
||||||
OSD.updateDisplaySize = function () {
|
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') {
|
if (video_type == 'AUTO') {
|
||||||
video_type = 'PAL';
|
video_type = 'PAL';
|
||||||
}
|
}
|
||||||
|
@ -2674,10 +2676,12 @@ OSD.GUI.updatePreviews = function() {
|
||||||
centerPosition += OSD.data.display_size.x / 2;
|
centerPosition += OSD.data.display_size.x / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hudCenterPosition = centerPosition + (OSD.constants.VIDEO_COLS[video_type] * $('#osd_horizon_offset').val());
|
||||||
|
|
||||||
// artificial horizon
|
// artificial horizon
|
||||||
if ($('input[name="ARTIFICIAL_HORIZON"]').prop('checked')) {
|
if ($('input[name="ARTIFICIAL_HORIZON"]').prop('checked')) {
|
||||||
for (i = 0; i < 9; i++) {
|
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');
|
crsHNumber = Settings.getInputValue('osd_crosshairs_style');
|
||||||
if (crsHNumber == 1) {
|
if (crsHNumber == 1) {
|
||||||
// AIRCRAFT style
|
// AIRCRAFT style
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 2, SYM.AH_AIRCRAFT0);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 2, SYM.AH_AIRCRAFT0);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_AIRCRAFT1);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_AIRCRAFT1);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_AIRCRAFT2);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_AIRCRAFT2);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_AIRCRAFT3);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_AIRCRAFT3);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 2, SYM.AH_AIRCRAFT4);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 2, SYM.AH_AIRCRAFT4);
|
||||||
} else if ((crsHNumber > 1) && (crsHNumber < 8)) {
|
} else if ((crsHNumber > 1) && (crsHNumber < 8)) {
|
||||||
// TYPES 3 to 8 (zero indexed)
|
// TYPES 3 to 8 (zero indexed)
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
||||||
} else {
|
} else {
|
||||||
// DEFAULT or unknown style
|
// DEFAULT or unknown style
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CENTER_LINE);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 1, SYM.AH_CENTER_LINE);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2709,12 +2713,12 @@ OSD.GUI.updatePreviews = function() {
|
||||||
var hudwidth = OSD.constants.AHISIDEBARWIDTHPOSITION;
|
var hudwidth = OSD.constants.AHISIDEBARWIDTHPOSITION;
|
||||||
var hudheight = OSD.constants.AHISIDEBARHEIGHTPOSITION;
|
var hudheight = OSD.constants.AHISIDEBARHEIGHTPOSITION;
|
||||||
for (i = -hudheight; i <= hudheight; i++) {
|
for (i = -hudheight; i <= hudheight; i++) {
|
||||||
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(centerPosition + 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
|
// AH level indicators
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - hudwidth + 1, SYM.AH_LEFT);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - hudwidth + 1, SYM.AH_LEFT);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + hudwidth - 1, SYM.AH_RIGHT);
|
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + hudwidth - 1, SYM.AH_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSD.GUI.updateMapPreview(centerPosition, 'MAP_NORTH', 'N', SYM.HOME);
|
OSD.GUI.updateMapPreview(centerPosition, 'MAP_NORTH', 'N', SYM.HOME);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue