mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 20:10:11 +03:00
Update OSD tab to support HD (50x18) mode
This commit is contained in:
parent
802b28c86b
commit
7dbb279c0f
6 changed files with 266 additions and 228 deletions
|
@ -1131,6 +1131,9 @@
|
||||||
"portsFunction_DJI_FPV": {
|
"portsFunction_DJI_FPV": {
|
||||||
"message": "DJI FPV VTX"
|
"message": "DJI FPV VTX"
|
||||||
},
|
},
|
||||||
|
"portsFunction_SHARKBYTE_OSD": {
|
||||||
|
"message": "Shark Byte OSD"
|
||||||
|
},
|
||||||
"portsFunction_IMU2": {
|
"portsFunction_IMU2": {
|
||||||
"message": "Secondary IMU"
|
"message": "Secondary IMU"
|
||||||
},
|
},
|
||||||
|
|
|
@ -44,6 +44,7 @@ var mspHelper = (function (gui) {
|
||||||
'DJI_FPV': 21,
|
'DJI_FPV': 21,
|
||||||
'SMARTPORT_MASTER': 23,
|
'SMARTPORT_MASTER': 23,
|
||||||
'IMU2': 24,
|
'IMU2': 24,
|
||||||
|
'SHARKBYTE_OSD': 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Required for MSP_DEBUGMSG because console.log() doesn't allow omitting
|
// Required for MSP_DEBUGMSG because console.log() doesn't allow omitting
|
||||||
|
|
|
@ -415,8 +415,28 @@ button {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-osd .third_left {
|
||||||
|
float: left;
|
||||||
|
width: calc(50% - 197px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-osd .third_right {
|
||||||
|
float: right;
|
||||||
|
width: calc(50% - 197px);
|
||||||
|
}
|
||||||
|
|
||||||
.tab-osd .preview {
|
.tab-osd .preview {
|
||||||
width: 360px;
|
width: 360px;
|
||||||
|
left: calc(50% - 197px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-osd .preview_hd {
|
||||||
|
width: 600px !important;
|
||||||
|
left: calc(50% - 317px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-osd .preview_hd_side {
|
||||||
|
width: calc(50% - 317px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-osd .preview {
|
.tab-osd .preview {
|
||||||
|
|
|
@ -25,9 +25,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cf_column twothird">
|
<div class="gui_box preview" style="float: left; position: fixed;">
|
||||||
<div class="gui_box grey preview" style="float: left; position: fixed;">
|
<div class="gui_box_titlebar">
|
||||||
<div class="gui_box_titlebar image">
|
|
||||||
<div class="spacer_box_title" data-i18n="osd_preview_title"></div>
|
<div class="spacer_box_title" data-i18n="osd_preview_title"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="display-layout">
|
<div class="display-layout">
|
||||||
|
@ -37,7 +36,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cf_column third_right" style="width: calc(100% - 377px);">
|
<div class="cf_column third_right">
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="osd_video_format"></div>
|
<div class="spacer_box_title" data-i18n="osd_video_format"></div>
|
||||||
|
@ -236,7 +235,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div id="fontmanagercontent" style="display:none; width:712px;">
|
<div id="fontmanagercontent" style="display:none; width:712px;">
|
||||||
<div class="font-picker" style="margin-bottom: 10px;">
|
<div class="font-picker" style="margin-bottom: 10px;">
|
||||||
<h1 class="tab_title">Font:</h1>
|
<h1 class="tab_title">Font:</h1>
|
||||||
|
@ -263,9 +261,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="content_toolbar supported hide">
|
<div class="content_toolbar supported hide">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
|
|
84
tabs/osd.js
84
tabs/osd.js
|
@ -136,7 +136,7 @@ FONT.constants = {
|
||||||
MAX_NVM_FONT_CHAR_FIELD_SIZE: 64,
|
MAX_NVM_FONT_CHAR_FIELD_SIZE: 64,
|
||||||
CHAR_HEIGHT: 18,
|
CHAR_HEIGHT: 18,
|
||||||
CHAR_WIDTH: 12,
|
CHAR_WIDTH: 12,
|
||||||
LINE: 30
|
LINE: 50
|
||||||
},
|
},
|
||||||
COLORS: {
|
COLORS: {
|
||||||
// black
|
// black
|
||||||
|
@ -512,19 +512,27 @@ OSD.DjiElements = {
|
||||||
};
|
};
|
||||||
|
|
||||||
OSD.constants = {
|
OSD.constants = {
|
||||||
VISIBLE: 0x0800,
|
VISIBLE: 0x2000,
|
||||||
VIDEO_TYPES: [
|
VIDEO_TYPES: [
|
||||||
'AUTO',
|
'AUTO',
|
||||||
'PAL',
|
'PAL',
|
||||||
'NTSC'
|
'NTSC',
|
||||||
|
'HD'
|
||||||
],
|
],
|
||||||
VIDEO_LINES: {
|
VIDEO_LINES: {
|
||||||
PAL: 16,
|
PAL: 16,
|
||||||
NTSC: 13
|
NTSC: 13,
|
||||||
|
HD: 18
|
||||||
|
},
|
||||||
|
VIDEO_COLS: {
|
||||||
|
PAL: 30,
|
||||||
|
NTSC: 30,
|
||||||
|
HD: 50
|
||||||
},
|
},
|
||||||
VIDEO_BUFFER_CHARS: {
|
VIDEO_BUFFER_CHARS: {
|
||||||
PAL: 480,
|
PAL: 480,
|
||||||
NTSC: 390
|
NTSC: 390,
|
||||||
|
HD: 900
|
||||||
},
|
},
|
||||||
UNIT_TYPES: [
|
UNIT_TYPES: [
|
||||||
{name: 'osdUnitImperial', value: 0},
|
{name: 'osdUnitImperial', value: 0},
|
||||||
|
@ -2003,9 +2011,17 @@ OSD.updateDisplaySize = function () {
|
||||||
if (video_type == 'AUTO') {
|
if (video_type == 'AUTO') {
|
||||||
video_type = 'PAL';
|
video_type = 'PAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('.third_left').toggleClass('preview_hd_side', (video_type == 'HD'))
|
||||||
|
$('.preview').toggleClass('preview_hd', (video_type == 'HD'))
|
||||||
|
$('.third_right').toggleClass('preview_hd_side', (video_type == 'HD'))
|
||||||
|
|
||||||
|
// Not sure I can do this! This will mess with the calculation of the y position of the widget
|
||||||
|
//FONT.constants.SIZES.LINE = OSD.constants.VIDEO_COLS[video_type];
|
||||||
|
|
||||||
// compute the size
|
// compute the size
|
||||||
OSD.data.display_size = {
|
OSD.data.display_size = {
|
||||||
x: FONT.constants.SIZES.LINE,
|
x: OSD.constants.VIDEO_COLS[video_type],
|
||||||
y: OSD.constants.VIDEO_LINES[video_type],
|
y: OSD.constants.VIDEO_LINES[video_type],
|
||||||
total: null
|
total: null
|
||||||
};
|
};
|
||||||
|
@ -2040,21 +2056,21 @@ OSD.msp = {
|
||||||
* b: blink flag
|
* b: blink flag
|
||||||
* y: y coordinate
|
* y: y coordinate
|
||||||
* x: x coordinate
|
* x: x coordinate
|
||||||
* 0000 vbyy yyyx xxxx
|
* 00vb yyyy yyxx xxxx
|
||||||
*/
|
*/
|
||||||
helpers: {
|
helpers: {
|
||||||
unpack: {
|
unpack: {
|
||||||
position: function (bits) {
|
position: function (bits) {
|
||||||
var display_item = {};
|
var display_item = {};
|
||||||
// size * y + x
|
// size * y + x
|
||||||
display_item.position = FONT.constants.SIZES.LINE * ((bits >> 5) & 0x001F) + (bits & 0x001F);
|
display_item.position = FONT.constants.SIZES.LINE * ((bits >> 6) & 0x003F) + (bits & 0x003F);
|
||||||
display_item.isVisible = (bits & OSD.constants.VISIBLE) != 0;
|
display_item.isVisible = (bits & OSD.constants.VISIBLE) != 0;
|
||||||
return display_item;
|
return display_item;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pack: {
|
pack: {
|
||||||
position: function (display_item) {
|
position: function (display_item) {
|
||||||
return (display_item.isVisible ? 0x0800 : 0) | (((display_item.position / FONT.constants.SIZES.LINE) & 0x001F) << 5) | (display_item.position % FONT.constants.SIZES.LINE);
|
return (display_item.isVisible ? 0x2000 : 0) | (((display_item.position / FONT.constants.SIZES.LINE) & 0x003F) << 6) | (display_item.position % FONT.constants.SIZES.LINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2649,16 +2665,16 @@ OSD.GUI.updatePreviews = function() {
|
||||||
item.preview_img.style.pointerEvents = 'none';
|
item.preview_img.style.pointerEvents = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
var centerishPosition = 255;
|
|
||||||
|
|
||||||
// AHI is one line up with NTSC (less lines) compared to PAL
|
var centerPosition = (OSD.data.display_size.x * OSD.data.display_size.y / 2);
|
||||||
if (OSD.constants.VIDEO_TYPES[OSD.data.video_system] == 'NTSC')
|
if (OSD.data.display_size.y % 2 == 0) {
|
||||||
centerishPosition -= OSD.data.display_size.x;
|
centerPosition += OSD.data.display_size.x / 2;
|
||||||
|
}
|
||||||
|
|
||||||
// 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(centerishPosition - 4 + i, SYM.AH_BAR9_0 + 4);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 4 + i, SYM.AH_BAR9_0 + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2667,21 +2683,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(centerishPosition - 2, SYM.AH_AIRCRAFT0);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 2, SYM.AH_AIRCRAFT0);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition - 1, SYM.AH_AIRCRAFT1);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_AIRCRAFT1);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition, SYM.AH_AIRCRAFT2);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_AIRCRAFT2);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition + 1, SYM.AH_AIRCRAFT3);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_AIRCRAFT3);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition + 2, SYM.AH_AIRCRAFT4);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 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(centerishPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CROSSHAIRS[crsHNumber][0]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber][1]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CROSSHAIRS[crsHNumber][2]);
|
||||||
} else {
|
} else {
|
||||||
// DEFAULT or unknown style
|
// DEFAULT or unknown style
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition - 1, SYM.AH_CENTER_LINE);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - 1, SYM.AH_CENTER_LINE);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition, SYM.AH_CROSSHAIRS[crsHNumber]);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + 1, SYM.AH_CENTER_LINE_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2690,21 +2706,17 @@ 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(centerishPosition - 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(centerishPosition + hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||||
}
|
}
|
||||||
// AH level indicators
|
// AH level indicators
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition - hudwidth + 1, SYM.AH_LEFT);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition - hudwidth + 1, SYM.AH_LEFT);
|
||||||
OSD.GUI.checkAndProcessSymbolPosition(centerishPosition + hudwidth - 1, SYM.AH_RIGHT);
|
OSD.GUI.checkAndProcessSymbolPosition(centerPosition + hudwidth - 1, SYM.AH_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapCenter = (OSD.data.display_size.x * OSD.data.display_size.y / 2);
|
OSD.GUI.updateMapPreview(centerPosition, 'MAP_NORTH', 'N', SYM.HOME);
|
||||||
if (OSD.data.display_size.y % 2 == 0) {
|
OSD.GUI.updateMapPreview(centerPosition, 'MAP_TAKEOFF', 'T', SYM.HOME);
|
||||||
mapCenter += OSD.data.display_size.x / 2;
|
OSD.GUI.updateMapPreview(centerPosition, 'RADAR', null, SYM.DIR_TO_HOME);
|
||||||
}
|
|
||||||
OSD.GUI.updateMapPreview(mapCenter, 'MAP_NORTH', 'N', SYM.HOME);
|
|
||||||
OSD.GUI.updateMapPreview(mapCenter, 'MAP_TAKEOFF', 'T', SYM.HOME);
|
|
||||||
OSD.GUI.updateMapPreview(mapCenter, 'RADAR', null, SYM.DIR_TO_HOME);
|
|
||||||
|
|
||||||
// render
|
// render
|
||||||
var $preview = $('.display-layout .preview').empty();
|
var $preview = $('.display-layout .preview').empty();
|
||||||
|
|
|
@ -93,6 +93,12 @@ TABS.ports.initialize = function (callback) {
|
||||||
maxPorts: 1 }
|
maxPorts: 1 }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
functionRules.push({
|
||||||
|
name: 'SHARKBYTE_OSD',
|
||||||
|
groups: ['peripherals'],
|
||||||
|
maxPorts: 1 }
|
||||||
|
);
|
||||||
|
|
||||||
functionRules.push({
|
functionRules.push({
|
||||||
name: 'SMARTPORT_MASTER',
|
name: 'SMARTPORT_MASTER',
|
||||||
groups: ['peripherals'],
|
groups: ['peripherals'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue