diff --git a/locales/en/messages.json b/locales/en/messages.json index f7aed4bc081..31229bea796 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -5110,6 +5110,9 @@ "osdSetupAlarmsTitle": { "message": "Alarms" }, + "osdSetupCarTitle": { + "message": "Camera Angle Reference" + }, "osdSetupStatsTitle": { "message": "Post Flight Statistics" }, @@ -6178,7 +6181,46 @@ "message": "Altitude", "description": "Text of the altitude alarm" }, - + "osdCarOptionScale": { + "message": "Scale", + "description": "Scale" + }, + "osdCarOptionWidth": { + "message": "Width", + "description": "Width" + }, + "osdCarOptionChannel": { + "message": "Channel", + "description": "Channel" + }, + "osdCarOptionDots": { + "message": "Dots", + "description": "Dots" + }, + "osdCarOptionSbarScale": { + "message": "Sidebar Scale", + "description": "Sidebar Scale" + }, + "osdCarOptionSbarLow": { + "message": "Sidebar Angle 1/5", + "description": "Sidebar Scale" + }, + "osdCarOptionSbarMidLow": { + "message": "Sidebar Angle 2/5", + "description": "Sidebar Scale" + }, + "osdCarOptionSbarMid": { + "message": "Sidebar Angle 3/5", + "description": "Sidebar Scale" + }, + "osdCarOptionSbarMidHigh": { + "message": "Sidebar Angle 4/5", + "description": "Sidebar Scale" + }, + "osdCarOptionSbarHigh": { + "message": "Sidebar Angle 5/5", + "description": "Sidebar Scale" + }, "osdWarningTextArmingDisabled": { "message": "Arming disabled", "description": "One of the warnings that can be selected to be shown in the OSD" @@ -6327,6 +6369,9 @@ "osdSectionHelpAlarms": { "message": "Set the thresholds used for OSD elements with alarm states." }, + "osdSectionHelpCar": { + "message": "Set the Camera Angle Reference parameter values" + }, "osdSectionHelpStats": { "message": "Set the values dispalyed on the post flight statistics screen." }, diff --git a/src/css/tabs/osd.less b/src/css/tabs/osd.less index ad117da6972..f810b78d71c 100644 --- a/src/css/tabs/osd.less +++ b/src/css/tabs/osd.less @@ -347,6 +347,30 @@ font-weight: normal; } } + .car { + label { + display: block; + width: 100%; + border-bottom: 1px solid var(--subtleAccent); + margin-top: 5px; + padding-bottom: 5px; + &:last-child { + border-bottom: none; + padding-bottom: 0; + } + } + input { + width: 55px; + padding-left: 3px; + height: 18px; + line-height: 20px; + text-align: left; + border-radius: 3px; + margin-right: 11px; + font-size: 11px; + font-weight: normal; + } + } .grid-row { justify-content: flex-start; gap: 7px; diff --git a/src/js/VirtualFC.js b/src/js/VirtualFC.js index ef118188914..205bee2c15f 100644 --- a/src/js/VirtualFC.js +++ b/src/js/VirtualFC.js @@ -233,6 +233,18 @@ const VirtualFC = { alt: { display_name: i18n.getMessage('osdTimerAlarmOptionAltitude'), value: 0 }, time: { display_name: 'Minutes', value: 0 }, }; + virtualOSD.data.car = { + scale: { display_name: i18n.getMessage('osdCarOptionScale'), value: 0 }, + width: { display_name: i18n.getMessage('osdCarOptionWidth'), value: 0 }, + channel: { display_name: i18n.getMessage('osdCarOptionChannel'), value: 0 }, + dots: { display_name: i18n.getMessage('osdCarOptionDots'), value: 0 }, + sbar_scale: { display_name: i18n.getMessage('osdCarOptionSbarScale'), value: 0 }, + sbar_low: { display_name: i18n.getMessage('osdCarOptionSbarLow'), value: 0 }, + sbar_mid_low: { display_name: i18n.getMessage('osdCarOptionSbarMidLow'), value: 0 }, + sbar_mid: { display_name: i18n.getMessage('osdCarOptionSbarMid'), value: 0 }, + sbar_mid_high: { display_name: i18n.getMessage('osdCarOptionSbarMidHigh'), value: 0 }, + sbar_high: { display_name: i18n.getMessage('osdCarOptionSbarHigh'), value: 0 }, + }; }, }; diff --git a/src/js/tabs/osd.js b/src/js/tabs/osd.js index 83e1ef24b3b..8f4391559ae 100644 --- a/src/js/tabs/osd.js +++ b/src/js/tabs/osd.js @@ -309,6 +309,7 @@ OSD.initData = function() { video_system: null, unit_mode: null, alarms: [], + car: [], statItems: [], warnings: [], displayItems: [], @@ -2208,6 +2209,7 @@ OSD.msp = { result.push16(OSD.data.alarms.cap.value); result.push16(0); // This value is unused by the firmware with configurable timers result.push16(OSD.data.alarms.alt.value); + let warningFlags = 0; for (let i = 0; i < OSD.data.warnings.length; i++) { @@ -2232,6 +2234,19 @@ OSD.msp = { result.push8(OSD.data.parameters.cameraFrameWidth); result.push8(OSD.data.parameters.cameraFrameHeight); } + if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) { + result.push8(OSD.data.car.scale.value); + result.push8(OSD.data.car.width.value); + result.push8(OSD.data.car.channel.value); + result.push8(OSD.data.car.dots.value); + + result.push8(OSD.data.car.sbar_scale.value); + result.push8(OSD.data.car.sbar_low.value); + result.push8(OSD.data.car.sbar_mid_low.value); + result.push8(OSD.data.car.sbar_mid.value); + result.push8(OSD.data.car.sbar_mid_high.value); + result.push8(OSD.data.car.sbar_high.value); + } } return result; }, @@ -2324,7 +2339,7 @@ OSD.msp = { d.alarms['alt'] = { display_name: i18n.getMessage('osdTimerAlarmOptionAltitude'), value: view.readU16() }; } } - + d.state = {}; d.state.haveSomeOsd = (d.flags !== 0); d.state.haveMax7456Configured = bit_check(d.flags, 4); @@ -2444,6 +2459,22 @@ OSD.msp = { d.parameters.cameraFrameHeight = view.readU8(); } + if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) { + d.car = {}; + d.car['scale'] = { display_name: i18n.getMessage('osdCarOptionScale'), value: view.readU8() }; + d.car['width'] = { display_name: i18n.getMessage('osdCarOptionWidth'), value: view.readU8() }; + d.car['channel'] = { display_name: i18n.getMessage('osdCarOptionChannel'), value: view.readU8() }; + d.car['dots'] = { display_name: i18n.getMessage('osdCarOptionDots'), value: view.readU8() }; + + d.car['sbar_scale'] = { display_name: i18n.getMessage('osdCarOptionSbarScale'), value: view.readU8() }; + d.car['sbar_low'] = { display_name: i18n.getMessage('osdCarOptionSbarLow'), value: view.readU8() }; + d.car['sbar_mid_low'] = { display_name: i18n.getMessage('osdCarOptionSbarMidLow'), value: view.readU8() }; + d.car['sbar_mid'] = { display_name: i18n.getMessage('osdCarOptionSbarMid'), value: view.readU8() }; + d.car['sbar_mid_high'] = { display_name: i18n.getMessage('osdCarOptionSbarMidHigh'), value: view.readU8() }; + d.car['sbar_high'] = { display_name: i18n.getMessage('osdCarOptionSbarHigh'), value: view.readU8() }; + + } + this.processOsdElements(d, itemsPositionsRead); OSD.updateDisplaySize(); @@ -2704,6 +2735,7 @@ osd.initialize = function(callback) { $('.units-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpUnits')); $('.timers-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpTimers')); $('.alarms-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpAlarms')); + $('.car-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpCar')); $('.stats-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpStats')); $('.warnings-container div.cf_tip').attr('title', i18n.getMessage('osdSectionHelpWarnings')); @@ -2822,6 +2854,22 @@ osd.initialize = function(callback) { $alarms.append($input); } + // Camera Angle Reference + $('.car-container').show(); + const $car = $('.car').empty(); + for (const k in OSD.data.car) { + const car = OSD.data.car[k]; + const carInput = $(`${car.display_name}`); + carInput.val(car.value); + carInput.focusout(function() { + OSD.data.car[$(this)[0].id].value = $(this)[0].value; + MSP.promise(MSPCodes.MSP_SET_OSD_CONFIG, OSD.msp.encodeOther()) + .then(updateOsdView); + }); + const $input = $('').append(carInput); + $car.append($input); + } + // Timers $('.timers-container').show(); const $timers = $('#timer-fields').empty(); diff --git a/src/tabs/osd.html b/src/tabs/osd.html index 3d4f0327c0b..140c970bb13 100644 --- a/src/tabs/osd.html +++ b/src/tabs/osd.html @@ -111,6 +111,14 @@