Merge remote-tracking branch 'origin/master' into dzikuvx-use-board-alignment-frame

pull/1461/head
Pawel Spychalski (DzikuVx) 3 years ago
commit a42a5fab5c

@ -973,7 +973,7 @@
"message": "Cycles/Sec (Hz)"
},
"configurationGPS": {
"message": "GPS"
"message": "Configuration"
},
"configurationGPSProtocol": {
"message": "Protocol"
@ -1624,10 +1624,10 @@
"message":"<ol><li>Remove propellers</li><li>Connect LiPo and use Outputs Tab to test all motors</li><li>Note the position of each motor (motor #1 - Left Top and so on)</li><li>Fill the table below</li></ol>"
},
"gpsHead": {
"message": "GPS"
"message": "Position"
},
"gpsStatHead": {
"message": "GPS Statistics"
"message": "Statistics"
},
"gpsMapHead": {
"message": "Current GPS location"

@ -64,7 +64,8 @@ var CONFIG,
SETTINGS,
BRAKING_CONFIG,
SAFEHOMES,
BOARD_ALIGNMENT;
BOARD_ALIGNMENT,
CURRENT_METER_CONFIG;
var FC = {
MAX_SERVO_RATE: 125,
@ -143,7 +144,14 @@ var FC = {
roll: 0,
pitch: 0,
yaw: 0
}
};
CURRENT_METER_CONFIG = {
scale: 0,
offset: 0,
type: 0,
capacity: 0
};
LED_STRIP = [];
LED_COLORS = [];
@ -583,7 +591,7 @@ var FC = {
{bit: 1, group: 'batteryVoltage', name: 'VBAT'},
{bit: 4, group: 'other', name: 'MOTOR_STOP'},
{bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true, showNameInTip: true},
{bit: 7, group: 'gps', name: 'GPS', haveTip: true},
{bit: 7, group: 'other', name: 'GPS', haveTip: true},
{bit: 10, group: 'other', name: 'TELEMETRY', showNameInTip: true},
{bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'},
{bit: 12, group: 'other', name: 'REVERSIBLE_MOTORS', showNameInTip: true},

@ -35,6 +35,8 @@ var MSPCodes = {
MSP_SET_MODE_RANGE: 35,
MSP_BOARD_ALIGNMENT: 38,
MSP_SET_BOARD_ALIGNMENT: 39,
MSP_CURRENT_METER_CONFIG: 40,
MSP_SET_CURRENT_METER_CONFIG: 41,
MSP_RX_CONFIG: 44,
MSP_SET_RX_CONFIG: 45,
MSP_LED_COLORS: 46,

@ -734,6 +734,7 @@ var mspHelper = (function (gui) {
case MSPCodes.MSP_SET_RX_MAP:
console.log('RCMAP saved');
break;
case MSPCodes.MSP_BF_CONFIG:
BF_CONFIG.mixerConfiguration = data.getUint8(0);
BF_CONFIG.features = data.getUint32(1, true);
@ -744,6 +745,7 @@ var mspHelper = (function (gui) {
BF_CONFIG.currentscale = data.getInt16(12, true);
BF_CONFIG.currentoffset = data.getInt16(14, true);
break;
case MSPCodes.MSP_SET_BF_CONFIG:
console.log('BF_CONFIG saved');
break;
@ -753,10 +755,22 @@ var mspHelper = (function (gui) {
BOARD_ALIGNMENT.pitch = data.getInt16(2, true); // -180 - 360
BOARD_ALIGNMENT.yaw = data.getInt16(4, true); // -180 - 360
break;
case MSPCodes.MSP_SET_BOARD_ALIGNMENT:
console.log('MSP_SET_BOARD_ALIGNMENT saved');
break;
case MSPCodes.MSP_CURRENT_METER_CONFIG:
CURRENT_METER_CONFIG.scale = data.getInt16(0, true);
CURRENT_METER_CONFIG.offset = data.getInt16(2, true);
CURRENT_METER_CONFIG.type = data.getUint8(4);
CURRENT_METER_CONFIG.capacity = data.getInt16(5, true);
break;
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
console.log('MSP_SET_CURRENT_METER_CONFIG saved');
break;
case MSPCodes.MSP_SET_REBOOT:
console.log('Reboot request accepted');
break;
@ -810,28 +824,6 @@ var mspHelper = (function (gui) {
console.log('Channel forwarding saved');
break;
case MSPCodes.MSP_CF_SERIAL_CONFIG:
SERIAL_CONFIG.ports = [];
var bytesPerPort = 1 + 2 + 4;
var serialPortCount = data.byteLength / bytesPerPort;
for (i = 0; i < serialPortCount; i++) {
var BAUD_RATES = mspHelper.BAUD_RATES_post1_6_3;
var serialPort = {
identifier: data.getUint8(offset),
functions: mspHelper.serialPortFunctionMaskToFunctions(data.getUint16(offset + 1, true)),
msp_baudrate: BAUD_RATES[data.getUint8(offset + 3)],
sensors_baudrate: BAUD_RATES[data.getUint8(offset + 4)],
telemetry_baudrate: BAUD_RATES[data.getUint8(offset + 5)],
blackbox_baudrate: BAUD_RATES[data.getUint8(offset + 6)]
};
offset += bytesPerPort;
SERIAL_CONFIG.ports.push(serialPort);
}
break;
case MSPCodes.MSP2_CF_SERIAL_CONFIG:
SERIAL_CONFIG.ports = [];
var bytesPerPort = 1 + 4 + 4;
@ -854,7 +846,6 @@ var mspHelper = (function (gui) {
}
break;
case MSPCodes.MSP_SET_CF_SERIAL_CONFIG:
case MSPCodes.MSP2_SET_CF_SERIAL_CONFIG:
console.log('Serial config saved');
break;
@ -1579,6 +1570,16 @@ var mspHelper = (function (gui) {
buffer.push(specificByte(BOARD_ALIGNMENT.yaw, 1));
break;
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
buffer.push(specificByte(CURRENT_METER_CONFIG.scale, 0));
buffer.push(specificByte(CURRENT_METER_CONFIG.scale, 1));
buffer.push(specificByte(CURRENT_METER_CONFIG.offset, 0));
buffer.push(specificByte(CURRENT_METER_CONFIG.offset, 1));
buffer.push(CURRENT_METER_CONFIG.type);
buffer.push(specificByte(CURRENT_METER_CONFIG.capacity, 0));
buffer.push(specificByte(CURRENT_METER_CONFIG.capacity, 1));
break;
case MSPCodes.MSP_SET_BF_CONFIG:
buffer.push(BF_CONFIG.mixerConfiguration);
buffer.push(specificByte(BF_CONFIG.features, 0));
@ -1832,24 +1833,6 @@ var mspHelper = (function (gui) {
}
break;
case MSPCodes.MSP_SET_CF_SERIAL_CONFIG:
for (i = 0; i < SERIAL_CONFIG.ports.length; i++) {
var serialPort = SERIAL_CONFIG.ports[i];
buffer.push(serialPort.identifier);
var functionMask = mspHelper.SERIAL_PORT_FUNCTIONSToMask(serialPort.functions);
buffer.push(specificByte(functionMask, 0));
buffer.push(specificByte(functionMask, 1));
var BAUD_RATES = mspHelper.BAUD_RATES_post1_6_3;
buffer.push(BAUD_RATES.indexOf(serialPort.msp_baudrate));
buffer.push(BAUD_RATES.indexOf(serialPort.sensors_baudrate));
buffer.push(BAUD_RATES.indexOf(serialPort.telemetry_baudrate));
buffer.push(BAUD_RATES.indexOf(serialPort.blackbox_baudrate));
}
break;
case MSPCodes.MSP2_SET_CF_SERIAL_CONFIG:
for (i = 0; i < SERIAL_CONFIG.ports.length; i++) {
var serialPort = SERIAL_CONFIG.ports[i];
@ -2827,6 +2810,10 @@ var mspHelper = (function (gui) {
self.loadBoardAlignment = function (callback) {
MSP.send_message(MSPCodes.MSP_BOARD_ALIGNMENT, false, false, callback);
};
self.loadCurrentMeterConfig = function (callback) {
MSP.send_message(MSPCodes.MSP_CURRENT_METER_CONFIG, false, false, callback);
};
self.queryFcStatus = function (callback) {
MSP.send_message(MSPCodes.MSPV2_INAV_STATUS, false, false, callback);
@ -2931,6 +2918,10 @@ var mspHelper = (function (gui) {
self.saveBfConfig = function (callback) {
MSP.send_message(MSPCodes.MSP_SET_BF_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BF_CONFIG), false, callback);
};
self.saveCurrentMeterConfig = function (callback) {
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CURRENT_METER_CONFIG), false, callback);
};
self.saveBoardAlignment = function (callback) {
MSP.send_message(MSPCodes.MSP_SET_BOARD_ALIGNMENT, mspHelper.crunch(MSPCodes.MSP_SET_BOARD_ALIGNMENT), false, callback);

@ -18,15 +18,7 @@ TABS.auxiliary.initialize = function (callback) {
}
function get_rc_data() {
if (SERIAL_CONFIG.ports.length == 0) {
MSP.send_message(MSPCodes.MSP_RC, false, false, get_serial_config);
} else {
MSP.send_message(MSPCodes.MSP_RC, false, false, load_html);
}
}
function get_serial_config() {
MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, load_html);
MSP.send_message(MSPCodes.MSP_RC, false, false, load_html);
}
function load_html() {

@ -76,64 +76,6 @@
</div>
</div>
</div>
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationGPS"></div>
</div>
<div class="spacer_box">
<div class="note">
<div class="note_spacer">
<p data-i18n="configurationGPSHelp"></p>
</div>
</div>
<div class="features gps"></div>
<!--feature list generated content-->
<div class="select">
<select id="gps_protocol" class="gps_protocol">
<!-- list generated here -->
</select>
<label for="gps_protocol">
<span data-i18n="configurationGPSProtocol"></span>
</label>
</div>
<div class="select">
<select id="gps_ubx_sbas" class="gps_ubx_sbas">
<!-- list generated here -->
</select>
<label for="gps_ubx_sbas">
<span data-i18n="configurationGPSubxSbas"></span>
</label>
</div>
<div class="number is-hidden">
<input type="number" id="mag_declination" name="mag_declination" step="0.1" min="-180" max="180" />
<label for="mag_declination">
<span data-i18n="configurationMagDeclination"></span>
</label>
</div>
<div class="checkbox">
<input type="checkbox" class="toggle update_preview" data-setting="gps_ublox_use_galileo" data-live="true">
<label for="gps_use_galileo">
<span data-i18n="configurationGPSUseGalileo"></span>
</label>
</div>
<div class="number">
<input type="number" id="tzOffset" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-1440" max="1440" />
<label for="tzOffset">
<span data-i18n="tzOffset"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="tzOffsetHelp"></div>
</div>
<div class="select">
<select id="tzAutomaticDST" data-setting="tz_automatic_dst"></select>
<label for="tzAutomaticDST">
<span data-i18n="tzAutomaticDST"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="tzAutomaticDSTHelp"></div>
</div>
</div>
</div>
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">

@ -40,6 +40,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
mspHelper.loadVTXConfig,
mspHelper.loadMixerConfig,
mspHelper.loadBoardAlignment,
mspHelper.loadCurrentMeterConfig,
loadCraftName,
mspHelper.loadMiscV2
];
@ -61,6 +62,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
mspHelper.saveINAVPidConfig,
mspHelper.saveVTXConfig,
mspHelper.saveBoardAlignment,
mspHelper.saveCurrentMeterConfig,
saveCraftName,
mspHelper.saveMiscV2,
saveSettings,
@ -148,32 +150,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
orientation_mag_e.val(SENSOR_ALIGNMENT.align_mag);
// generate GPS
var gpsProtocols = FC.getGpsProtocols();
var gpsSbas = FC.getGpsSbasProviders();
var gps_protocol_e = $('#gps_protocol');
for (i = 0; i < gpsProtocols.length; i++) {
gps_protocol_e.append('<option value="' + i + '">' + gpsProtocols[i] + '</option>');
}
gps_protocol_e.change(function () {
MISC.gps_type = parseInt($(this).val());
});
gps_protocol_e.val(MISC.gps_type);
var gps_ubx_sbas_e = $('#gps_ubx_sbas');
for (i = 0; i < gpsSbas.length; i++) {
gps_ubx_sbas_e.append('<option value="' + i + '">' + gpsSbas[i] + '</option>');
}
gps_ubx_sbas_e.change(function () {
MISC.gps_ubx_sbas = parseInt($(this).val());
});
gps_ubx_sbas_e.val(MISC.gps_ubx_sbas);
// VTX
var config_vtx = $('.config-vtx');
if (VTX_CONFIG.device_type != VTX.DEV_UNKNOWN) {
@ -272,8 +248,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('#voltagescale').val(MISC.vbatscale);
// fill current
$('#currentscale').val(BF_CONFIG.currentscale);
$('#currentoffset').val(BF_CONFIG.currentoffset / 10);
$('#currentscale').val(CURRENT_METER_CONFIG.scale);
$('#currentoffset').val(CURRENT_METER_CONFIG.offset / 10);
// fill battery capacity
$('#battery_capacity').val(MISC.battery_capacity);
@ -375,13 +351,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
}
helper.features.reset();
helper.features.fromUI($('.tab-configuration'));
helper.features.execute(function () {
BOARD_ALIGNMENT.yaw = Math.round(parseFloat($('input[name="board_align_yaw"]').val()) * 10);
BF_CONFIG.currentscale = parseInt($('#currentscale').val());
BF_CONFIG.currentoffset = Math.round(parseFloat($('#currentoffset').val()) * 10);
CURRENT_METER_CONFIG.scale = parseInt($('#currentscale').val());
CURRENT_METER_CONFIG.offset = Math.round(parseFloat($('#currentoffset').val()) * 10);
saveChainer.execute();
});
});

@ -1,8 +1,78 @@
<div class="tab-gps">
<div class="tab-gps toolbar_fixed_bottom">
<div class="content_wrapper">
<div class="tab_title" data-i18n="tabGPS">GPS</div>
<div class="cf_column fourth">
<div class="cf_column third_left">
<div class="spacer_right">
<div class="config-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="configurationGPS"></div>
</div>
<div class="spacer_box">
<div class="note">
<div class="note_spacer">
<p data-i18n="configurationGPSHelp"></p>
</div>
</div>
<div class="checkbox">
<input type="checkbox" data-bit="7" class="feature toggle" name="GPS" title="GPS"
id="feature-7">
<label for="feature-7">
<span data-i18n="featureGPS"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="featureGPSTip"></div>
</div>
<div class="select">
<select id="gps_protocol" class="gps_protocol">
<!-- list generated here -->
</select>
<label for="gps_protocol">
<span data-i18n="configurationGPSProtocol"></span>
</label>
</div>
<div class="select">
<select id="gps_ubx_sbas" class="gps_ubx_sbas">
<!-- list generated here -->
</select>
<label for="gps_ubx_sbas">
<span data-i18n="configurationGPSubxSbas"></span>
</label>
</div>
<div class="number is-hidden">
<input type="number" id="mag_declination" name="mag_declination" step="0.1" min="-180"
max="180" />
<label for="mag_declination">
<span data-i18n="configurationMagDeclination"></span>
</label>
</div>
<div class="checkbox">
<input type="checkbox" class="toggle update_preview" data-setting="gps_ublox_use_galileo"
data-live="true">
<label for="gps_use_galileo">
<span data-i18n="configurationGPSUseGalileo"></span>
</label>
</div>
<div class="number">
<input type="number" id="tzOffset" data-setting="tz_offset" data-setting-multiplier="1"
step="1" min="-1440" max="1440" />
<label for="tzOffset">
<span data-i18n="tzOffset"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="tzOffsetHelp"></div>
</div>
<div class="select">
<select id="tzAutomaticDST" data-setting="tz_automatic_dst"></select>
<label for="tzAutomaticDST">
<span data-i18n="tzAutomaticDST"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="tzAutomaticDSTHelp"></div>
</div>
</div>
</div>
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="gpsHead"></div>
@ -80,18 +150,23 @@
</div>
</div>
<div class="cf_column threefourth_left">
<div class="cf_column twothird">
<div class="gui_box grey gps_map">
<div class="gui_box_titlebar" style="margin-bottom: 0;">
<div class="spacer_box_title" data-i18n="gpsMapHead"></div>
</div>
<div id="loadmap">
<div style="height:100%" id="gps-map">
<button class="map-button" id="center_button" data-i18n="gps_map_center"></button>
<button class="map-button" id="center_button" data-i18n="gps_map_center"></button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="content_toolbar">
<div class="btn save_btn">
<a class="save" href="#" data-i18n="configurationButtonSave"></a>
</div>
</div>
</div>
</div>
</div>

@ -1,3 +1,4 @@
/*global $,MSPChainerClass,googleAnalytics,mspHelper,MSPCodes,GUI,chrome,MSP,TABS,Settings,helper,ol*/
'use strict';
TABS.gps = {};
@ -8,11 +9,49 @@ TABS.gps.initialize = function (callback) {
googleAnalytics.sendAppView('GPS');
}
function load_html() {
GUI.load("./tabs/gps.html", process_html);
var loadChainer = new MSPChainerClass();
var loadChain = [
mspHelper.loadBfConfig,
mspHelper.loadMiscV2
];
loadChainer.setChain(loadChain);
loadChainer.setExitPoint(load_html);
loadChainer.execute();
var saveChainer = new MSPChainerClass();
var saveChain = [
mspHelper.saveBfConfig,
mspHelper.saveMiscV2,
saveSettings,
mspHelper.saveToEeprom
];
function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete);
}
saveChainer.setChain(saveChain);
saveChainer.setExitPoint(reboot);
function reboot() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.handleReconnect($('.tab_gps a'));
});
});
}
load_html();
function load_html() {
GUI.load("./tabs/gps.html", Settings.processHtml(process_html));
}
let cursorInitialized = false;
let iconStyle;
@ -23,6 +62,36 @@ TABS.gps.initialize = function (callback) {
function process_html() {
localize();
var features = FC.getFeatures();
helper.features.updateUI($('.tab-gps'), BF_CONFIG.features);
// generate GPS
var gpsProtocols = FC.getGpsProtocols();
var gpsSbas = FC.getGpsSbasProviders();
var gps_protocol_e = $('#gps_protocol');
for (i = 0; i < gpsProtocols.length; i++) {
gps_protocol_e.append('<option value="' + i + '">' + gpsProtocols[i] + '</option>');
}
gps_protocol_e.change(function () {
MISC.gps_type = parseInt($(this).val());
});
gps_protocol_e.val(MISC.gps_type);
var gps_ubx_sbas_e = $('#gps_ubx_sbas');
for (i = 0; i < gpsSbas.length; i++) {
gps_ubx_sbas_e.append('<option value="' + i + '">' + gpsSbas[i] + '</option>');
}
gps_ubx_sbas_e.change(function () {
MISC.gps_ubx_sbas = parseInt($(this).val());
});
gps_ubx_sbas_e.val(MISC.gps_ubx_sbas);
let mapView = new ol.View({
center: ol.proj.fromLonLat([0, 0]),
zoom: 15
@ -36,20 +105,20 @@ TABS.gps.initialize = function (callback) {
imagerySet: 'AerialWithLabels',
maxZoom: 19
});
} else if ( globalSettings.mapProviderType == 'mapproxy' ) {
mapLayer = new ol.source.TileWMS({
url: globalSettings.proxyURL,
params: {'LAYERS':globalSettings.proxyLayer}
})
} else if (globalSettings.mapProviderType == 'mapproxy') {
mapLayer = new ol.source.TileWMS({
url: globalSettings.proxyURL,
params: { 'LAYERS': globalSettings.proxyLayer }
})
} else {
mapLayer = new ol.source.OSM();
}
$("#center_button").click(function(){
let lat = GPS_DATA.lat / 10000000;
let lon = GPS_DATA.lon / 10000000;
let center = ol.proj.fromLonLat([lon, lat]);
mapView.setCenter(center);
$("#center_button").click(function () {
let lat = GPS_DATA.lat / 10000000;
let lon = GPS_DATA.lon / 10000000;
let center = ol.proj.fromLonLat([lon, lat]);
mapView.setCenter(center);
});
mapHandler = new ol.Map({
@ -144,7 +213,7 @@ TABS.gps.initialize = function (callback) {
});
mapHandler.addLayer(currentPositionLayer);
mapView.setCenter(center);
mapView.setZoom(14);
}
@ -172,6 +241,29 @@ TABS.gps.initialize = function (callback) {
get_raw_gps_data();
});
$('a.save').on('click', function () {
if (FC.isFeatureEnabled('GPS', features)) {
googleAnalytics.sendEvent('Setting', 'GpsProtocol', gpsProtocols[MISC.gps_type]);
googleAnalytics.sendEvent('Setting', 'GpsSbas', gpsSbas[MISC.gps_ubx_sbas]);
}
googleAnalytics.sendEvent('Setting', 'GPSEnabled', FC.isFeatureEnabled('GPS', features) ? "true" : "false");
for (var i = 0; i < features.length; i++) {
var featureName = features[i].name;
if (FC.isFeatureEnabled(featureName, features)) {
googleAnalytics.sendEvent('Setting', 'Feature', featureName);
}
}
helper.features.reset();
helper.features.fromUI($('.tab-gps'));
helper.features.execute(function () {
saveChainer.execute();
});
});
GUI.content_ready(callback);
}

@ -2011,13 +2011,18 @@ OSD.updateDisplaySize = function () {
video_type = 'PAL';
}
// save the original OSD element positions.
var origPos = [];
for (var ii = 0; ii < OSD.data.items.length; ii++) {
origPos.push(OSD.msp.helpers.pack.position(OSD.data.items[ii]));
// save the original OSD element positions for all layouts
var osdLayouts = [];
for (var ii = 0; ii < OSD.data.layout_count; ii++) {
var items = OSD.data.layouts[ii];
var origPos = [];
for (var jj = 0; jj < OSD.data.items.length; jj++) {
origPos.push(OSD.msp.helpers.pack.position(items[jj]));
}
osdLayouts.push(origPos);
}
// save the new video type and cols per line
// set the new video type and cols per line
FONT.constants.SIZES.LINE = OSD.constants.VIDEO_COLS[video_type];
OSD.constants.VIDEO_TYPES[OSD.data.video_system] = video_type;
@ -2028,16 +2033,20 @@ OSD.updateDisplaySize = function () {
total: OSD.constants.VIDEO_BUFFER_CHARS[video_type]
};
// recalculate the OSD element positions for the new cols per line
for (var ii = 0; ii < OSD.data.items.length; ii++) {
var item = OSD.msp.helpers.unpack.position(origPos[ii]);
// do not recalculate anything not visible or outside of the screen
if (item.isVisible && item.x < OSD.data.display_size.x && item.y < OSD.data.display_size.y) {
OSD.data.items[ii] = item;
}
}
// set the preview size
// re-calculate the OSD element positions for each layout
for (var ii = 0; ii < OSD.data.layout_count; ii++) {
var origPos = osdLayouts[ii];
var items = OSD.data.layouts[ii];
for (var jj = 0; jj < OSD.data.item_count; jj++) {
var item = OSD.msp.helpers.unpack.position(origPos[jj]);
// leave element alone if outside of screen (enable and disable element to relocate to 0,0)
if (item.x < OSD.data.display_size.x && item.y < OSD.data.display_size.y) {
items[jj] = item;
}
}
}
// 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'))
@ -2094,7 +2103,7 @@ OSD.msp = {
},
pack: {
position: function (display_item) {
return (display_item.isVisible ? 0x2000 : 0)
return (display_item.isVisible ? OSD.constants.VISIBLE : 0)
| ((display_item.y & 0x3F) << 6) | (display_item.x & 0x3F);
}
}

Loading…
Cancel
Save