From ffee3d3935a3da851a81088942e394db3a682e17 Mon Sep 17 00:00:00 2001 From: Jeff Hendrix Date: Sat, 1 Oct 2022 00:40:50 -0600 Subject: [PATCH 1/3] Added support for DJI wtfos MSP-OSD full screen 59x22 OSD --- js/msp/MSPHelper.js | 10 ++++----- src/css/tabs/osd.css | 25 ++++++++++++++++++++- tabs/osd.js | 53 +++++++++++++++++++++++++++++++++++--------- tabs/ports.js | 4 ++-- 4 files changed, 74 insertions(+), 18 deletions(-) diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 01b5789d0..ec9b976d8 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -477,9 +477,9 @@ var mspHelper = (function (gui) { data.getInt8(i + 13) )); } - } + } break; - + case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_SINGLE: LOGIC_CONDITIONS.put(new LogicCondition( data.getInt8(0), @@ -788,7 +788,7 @@ var mspHelper = (function (gui) { } CONFIG.target = targetName; } - + break; case MSPCodes.MSP_SET_CHANNEL_FORWARDING: @@ -2282,8 +2282,8 @@ var mspHelper = (function (gui) { } }; - self.loadLogicConditions = function (callback) { - if (semver.gte(CONFIG.flightControllerVersion, "5.0.0")) { + self.loadLogicConditions = function (callback) { + if (semver.gte(CONFIG.flightControllerVersion, "5.0.0")) { LOGIC_CONDITIONS.flush(); let idx = 0; MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_SINGLE, [idx], false, nextLogicCondition); diff --git a/src/css/tabs/osd.css b/src/css/tabs/osd.css index 89db9aeff..4375a2ba6 100644 --- a/src/css/tabs/osd.css +++ b/src/css/tabs/osd.css @@ -453,6 +453,29 @@ button { width: calc(50% - 317px) !important; } +.tab-osd .preview_dji_hd { + width: 720px !important; + left: calc(50% - 377px) !important; +} + +.tab-osd .dji_hd_43_left { + border-left: 1px solid red; + position: absolute; + left: 72px; + height: calc(100% - 27px); +} + +.tab-osd .dji_hd_43_right { + border-right: 1px solid red; + position: absolute; + right: 72px; + height: calc(100% - 27px); +} + +.tab-osd .preview_dji_hd_side { + width: calc(50% - 377px) !important; +} + .tab-osd .preview { /* please don't copy the generic background image from another project * and replace the one that @nathantsoi took :) @@ -538,7 +561,7 @@ button { } .tab-osd .settings select, -.tab-osd .settings input, +.tab-osd .settings input, .tab-osd .osd_settings .switchery, .tab-osd .unit_wrapper { vertical-align: top; diff --git a/tabs/osd.js b/tabs/osd.js index 44bd89d38..099ff15fb 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -532,22 +532,26 @@ OSD.constants = { 'AUTO', 'PAL', 'NTSC', - 'HD' + 'HDZERO', + 'DJIWTF' ], VIDEO_LINES: { PAL: 16, NTSC: 13, - HD: 18 + HDZERO: 18, + DJIWTF: 22 }, VIDEO_COLS: { PAL: 30, NTSC: 30, - HD: 50 + HDZERO: 50, + DJIWTF: 60 }, VIDEO_BUFFER_CHARS: { PAL: 480, NTSC: 390, - HD: 900 + HDZERO: 900, + DJIWTF: 1320 }, UNIT_TYPES: [ {name: 'osdUnitImperial', value: 0}, @@ -2063,12 +2067,19 @@ OSD.updateDisplaySize = function () { } } + // set the preview size if dji wtf + $('.third_left').toggleClass('preview_dji_hd_side', video_type == 'DJIWTF') + $('.preview').toggleClass('preview_dji_hd cut43_left', video_type == 'DJIWTF') + $('.third_right').toggleClass('preview_dji_hd_side', video_type == 'DJIWTF') + $('.left_43_margin').toggleClass('dji_hd_43_left', video_type == 'DJIWTF') + $('.right_43_margin').toggleClass('dji_hd_43_right', video_type == 'DJIWTF') + // set the preview size based on the video type - $('.third_left').toggleClass('preview_hd_side', (video_type == 'HD')) - $('.preview').toggleClass('preview_hd cut43_left', (video_type == 'HD')) - $('.third_right').toggleClass('preview_hd_side', (video_type == 'HD')) - $('.left_43_margin').toggleClass('hd_43_left', (video_type == 'HD')) - $('.right_43_margin').toggleClass('hd_43_right', (video_type == 'HD')) + $('.third_left').toggleClass('preview_hd_side', (video_type == 'HDZERO')) + $('.preview').toggleClass('preview_hd cut43_left', (video_type == 'HDZERO')) + $('.third_right').toggleClass('preview_hd_side', (video_type == 'HDZERO')) + $('.left_43_margin').toggleClass('hd_43_left', (video_type == 'HDZERO')) + $('.right_43_margin').toggleClass('hd_43_right', (video_type == 'HDZERO')) }; OSD.saveAlarms = function(callback) { @@ -2354,7 +2365,7 @@ OSD.GUI.checkAndProcessSymbolPosition = function(pos, charCode) { OSD.GUI.updateVideoMode = function() { // video mode var $videoTypes = $('.video-types').empty(); - for (var i = 0; i < OSD.constants.VIDEO_TYPES.length; i++) { + for (var i = 0; i < OSD.constants.VIDEO_TYPES.length - 2; i++) { $videoTypes.append( $('