mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 13:25:24 +03:00
Change lexical scope receiver and failsafe
This commit is contained in:
parent
317f937fd5
commit
1a3dc52f58
3 changed files with 180 additions and 197 deletions
|
@ -3,7 +3,7 @@
|
||||||
TABS.failsafe = {};
|
TABS.failsafe = {};
|
||||||
|
|
||||||
TABS.failsafe.initialize = function (callback, scrollPosition) {
|
TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
if (GUI.active_tab != 'failsafe') {
|
if (GUI.active_tab != 'failsafe') {
|
||||||
GUI.active_tab = 'failsafe';
|
GUI.active_tab = 'failsafe';
|
||||||
|
@ -80,16 +80,16 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME cleanup oldpane html and css
|
// FIXME cleanup oldpane html and css
|
||||||
var oldPane = $('div.oldpane');
|
const oldPane = $('div.oldpane');
|
||||||
oldPane.prop("disabled", true);
|
oldPane.prop("disabled", true);
|
||||||
oldPane.hide();
|
oldPane.hide();
|
||||||
|
|
||||||
// generate labels for assigned aux modes
|
// generate labels for assigned aux modes
|
||||||
var auxAssignment = [],
|
const auxAssignment = [];
|
||||||
i,
|
|
||||||
element;
|
|
||||||
|
|
||||||
for (var channelIndex = 0; channelIndex < FC.RC.active_channels - 4; channelIndex++) {
|
let element;
|
||||||
|
|
||||||
|
for (let channelIndex = 0; channelIndex < FC.RC.active_channels - 4; channelIndex++) {
|
||||||
auxAssignment.push("");
|
auxAssignment.push("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,25 +97,25 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
auxAssignment[FC.RSSI_CONFIG.channel - 5] += "<span class=\"modename\">" + "RSSI" + "</span>"; // Aux channels start at 5 in backend so we have to substract 5
|
auxAssignment[FC.RSSI_CONFIG.channel - 5] += "<span class=\"modename\">" + "RSSI" + "</span>"; // Aux channels start at 5 in backend so we have to substract 5
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var modeIndex = 0; modeIndex < FC.AUX_CONFIG.length; modeIndex++) {
|
for (let modeIndex = 0; modeIndex < FC.AUX_CONFIG.length; modeIndex++) {
|
||||||
|
|
||||||
var modeId = FC.AUX_CONFIG_IDS[modeIndex];
|
const modeId = FC.AUX_CONFIG_IDS[modeIndex];
|
||||||
|
|
||||||
// scan mode ranges to find assignments
|
// scan mode ranges to find assignments
|
||||||
for (var modeRangeIndex = 0; modeRangeIndex < FC.MODE_RANGES.length; modeRangeIndex++) {
|
for (let modeRangeIndex = 0; modeRangeIndex < FC.MODE_RANGES.length; modeRangeIndex++) {
|
||||||
var modeRange = FC.MODE_RANGES[modeRangeIndex];
|
const modeRange = FC.MODE_RANGES[modeRangeIndex];
|
||||||
|
|
||||||
if (modeRange.id != modeId) {
|
if (modeRange.id != modeId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = modeRange.range;
|
const range = modeRange.range;
|
||||||
if (!(range.start < range.end)) {
|
if (range.start >= range.end) {
|
||||||
continue; // invalid!
|
continue; // invalid!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for the real name if it belongs to a peripheral
|
// Search for the real name if it belongs to a peripheral
|
||||||
var modeName = FC.AUX_CONFIG[modeIndex];
|
let modeName = FC.AUX_CONFIG[modeIndex];
|
||||||
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
|
modeName = adjustBoxNameIfPeripheralWithModeID(modeId, modeName);
|
||||||
|
|
||||||
auxAssignment[modeRange.auxChannelIndex] += "<span class=\"modename\">" + modeName + "</span>";
|
auxAssignment[modeRange.auxChannelIndex] += "<span class=\"modename\">" + modeName + "</span>";
|
||||||
|
@ -123,17 +123,17 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate full channel list
|
// generate full channel list
|
||||||
var channelNames = [
|
const channelNames = [
|
||||||
i18n.getMessage('controlAxisRoll'),
|
i18n.getMessage('controlAxisRoll'),
|
||||||
i18n.getMessage('controlAxisPitch'),
|
i18n.getMessage('controlAxisPitch'),
|
||||||
i18n.getMessage('controlAxisYaw'),
|
i18n.getMessage('controlAxisYaw'),
|
||||||
i18n.getMessage('controlAxisThrottle')
|
i18n.getMessage('controlAxisThrottle')
|
||||||
],
|
],
|
||||||
fullChannels_e = $('div.activechannellist'),
|
fullChannels_e = $('div.activechannellist');
|
||||||
aux_index = 1,
|
let aux_index = 1,
|
||||||
aux_assignment_index = 0;
|
aux_assignment_index = 0;
|
||||||
|
|
||||||
for (i = 0; i < FC.RXFAIL_CONFIG.length; i++) {
|
for (let i = 0; i < FC.RXFAIL_CONFIG.length; i++) {
|
||||||
if (i < channelNames.length) {
|
if (i < channelNames.length) {
|
||||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||||
fullChannels_e.append('\
|
fullChannels_e.append('\
|
||||||
|
@ -185,23 +185,23 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var channel_mode_array = [];
|
const channel_mode_array = [];
|
||||||
$('.number', fullChannels_e).each(function () {
|
$('.number', fullChannels_e).each(function () {
|
||||||
channel_mode_array.push($('select.aux_set' , this));
|
channel_mode_array.push($('select.aux_set' , this));
|
||||||
});
|
});
|
||||||
|
|
||||||
var channel_value_array = [];
|
const channel_value_array = [];
|
||||||
$('.number', fullChannels_e).each(function () {
|
$('.number', fullChannels_e).each(function () {
|
||||||
channel_value_array.push($('input[name="aux_value"]' , this));
|
channel_value_array.push($('input[name="aux_value"]' , this));
|
||||||
});
|
});
|
||||||
|
|
||||||
var channelMode = $('select.aux_set');
|
const channelMode = $('select.aux_set');
|
||||||
var channelValue = $('input[name="aux_value"]');
|
const channelValue = $('input[name="aux_value"]');
|
||||||
|
|
||||||
// UI hooks
|
// UI hooks
|
||||||
channelMode.change(function () {
|
channelMode.change(function () {
|
||||||
var currentMode = parseInt($(this).val());
|
const currentMode = parseInt($(this).val());
|
||||||
var i = parseInt($(this).prop("id"));
|
const i = parseInt($(this).prop("id"));
|
||||||
FC.RXFAIL_CONFIG[i].mode = currentMode;
|
FC.RXFAIL_CONFIG[i].mode = currentMode;
|
||||||
if (currentMode == 2) {
|
if (currentMode == 2) {
|
||||||
channel_value_array[i].prop("disabled", false);
|
channel_value_array[i].prop("disabled", false);
|
||||||
|
@ -214,7 +214,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
// UI hooks
|
// UI hooks
|
||||||
channelValue.change(function () {
|
channelValue.change(function () {
|
||||||
var i = parseInt($(this).prop("id"));
|
const i = parseInt($(this).prop("id"));
|
||||||
FC.RXFAIL_CONFIG[i].value = parseInt($(this).val());
|
FC.RXFAIL_CONFIG[i].value = parseInt($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="rx_max_usec"]').val(FC.RX_CONFIG.rx_max_usec);
|
$('input[name="rx_max_usec"]').val(FC.RX_CONFIG.rx_max_usec);
|
||||||
|
|
||||||
// fill fallback settings (mode and value) for all channels
|
// fill fallback settings (mode and value) for all channels
|
||||||
for (i = 0; i < FC.RXFAIL_CONFIG.length; i++) {
|
for (let i = 0; i < FC.RXFAIL_CONFIG.length; i++) {
|
||||||
channel_value_array[i].val(FC.RXFAIL_CONFIG[i].value);
|
channel_value_array[i].val(FC.RXFAIL_CONFIG[i].value);
|
||||||
channel_mode_array[i].val(FC.RXFAIL_CONFIG[i].mode);
|
channel_mode_array[i].val(FC.RXFAIL_CONFIG[i].mode);
|
||||||
channel_mode_array[i].change();
|
channel_mode_array[i].change();
|
||||||
|
@ -240,7 +240,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
$('tbody.rxFailsafe').hide();
|
$('tbody.rxFailsafe').hide();
|
||||||
toggleStage2(true);
|
toggleStage2(true);
|
||||||
} else {
|
} else {
|
||||||
var failsafeFeature = $('input[name="FAILSAFE"]');
|
const failsafeFeature = $('input[name="FAILSAFE"]');
|
||||||
failsafeFeature.change(function () {
|
failsafeFeature.change(function () {
|
||||||
toggleStage2($(this).is(':checked'));
|
toggleStage2($(this).is(':checked'));
|
||||||
});
|
});
|
||||||
|
@ -254,18 +254,13 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
// set stage 2 failsafe procedure
|
// set stage 2 failsafe procedure
|
||||||
$('input[type="radio"].procedure').change(function () {
|
$('input[type="radio"].procedure').change(function () {
|
||||||
var element = $(this),
|
|
||||||
checked = element.is(':checked'),
|
|
||||||
id = element.attr('id');
|
|
||||||
|
|
||||||
// Disable all the settings
|
// Disable all the settings
|
||||||
$('.proceduresettings :input').attr('disabled',true);
|
$('.proceduresettings :input').attr('disabled',true);
|
||||||
// Enable only selected
|
// Enable only selected
|
||||||
element.parent().parent().find(':input').attr('disabled',false);
|
$(this).parent().parent().find(':input').attr('disabled',false);
|
||||||
});
|
});
|
||||||
|
|
||||||
switch(FC.FAILSAFE_CONFIG.failsafe_procedure) {
|
switch(FC.FAILSAFE_CONFIG.failsafe_procedure) {
|
||||||
default:
|
|
||||||
case 0:
|
case 0:
|
||||||
element = $('input[id="land"]') ;
|
element = $('input[id="land"]') ;
|
||||||
element.prop('checked', true);
|
element.prop('checked', true);
|
||||||
|
|
|
@ -8,7 +8,7 @@ TABS.receiver = {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.receiver.initialize = function (callback) {
|
TABS.receiver.initialize = function (callback) {
|
||||||
var tab = this;
|
const tab = this;
|
||||||
|
|
||||||
if (GUI.active_tab != 'receiver') {
|
if (GUI.active_tab != 'receiver') {
|
||||||
GUI.active_tab = 'receiver';
|
GUI.active_tab = 'receiver';
|
||||||
|
@ -31,20 +31,20 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_rc_configs() {
|
function load_rc_configs() {
|
||||||
var next_callback = load_rx_config;
|
const nextCallback = load_rx_config;
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, nextCallback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
nextCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_rx_config() {
|
function load_rx_config() {
|
||||||
var next_callback = load_mixer_config;
|
const nextCallback = load_mixer_config;
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, nextCallback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
nextCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,26 +97,27 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate bars
|
// generate bars
|
||||||
var bar_names = [
|
const bar_names = [
|
||||||
i18n.getMessage('controlAxisRoll'),
|
i18n.getMessage('controlAxisRoll'),
|
||||||
i18n.getMessage('controlAxisPitch'),
|
i18n.getMessage('controlAxisPitch'),
|
||||||
i18n.getMessage('controlAxisYaw'),
|
i18n.getMessage('controlAxisYaw'),
|
||||||
i18n.getMessage('controlAxisThrottle')
|
i18n.getMessage('controlAxisThrottle')
|
||||||
],
|
];
|
||||||
bar_container = $('.tab-receiver .bars'),
|
|
||||||
aux_index = 1;
|
|
||||||
|
|
||||||
var num_bars = (FC.RC.active_channels > 0) ? FC.RC.active_channels : 8;
|
const barContainer = $('.tab-receiver .bars');
|
||||||
|
let auxIndex = 1;
|
||||||
|
|
||||||
for (var i = 0; i < num_bars; i++) {
|
const numBars = (FC.RC.active_channels > 0) ? FC.RC.active_channels : 8;
|
||||||
var name;
|
|
||||||
|
for (let i = 0; i < numBars; i++) {
|
||||||
|
let name;
|
||||||
if (i < bar_names.length) {
|
if (i < bar_names.length) {
|
||||||
name = bar_names[i];
|
name = bar_names[i];
|
||||||
} else {
|
} else {
|
||||||
name = i18n.getMessage("controlAxisAux" + (aux_index++));
|
name = i18n.getMessage("controlAxisAux" + (auxIndex++));
|
||||||
}
|
}
|
||||||
|
|
||||||
bar_container.append('\
|
barContainer.append('\
|
||||||
<ul>\
|
<ul>\
|
||||||
<li class="name">' + name + '</li>\
|
<li class="name">' + name + '</li>\
|
||||||
<li class="meter">\
|
<li class="meter">\
|
||||||
|
@ -132,53 +133,53 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we could probably use min and max throttle for the range, will see
|
// we could probably use min and max throttle for the range, will see
|
||||||
var meter_scale = {
|
const meterScale = {
|
||||||
'min': 800,
|
'min': 800,
|
||||||
'max': 2200
|
'max': 2200
|
||||||
};
|
};
|
||||||
|
|
||||||
var meter_fill_array = [];
|
const meterFillArray = [];
|
||||||
$('.meter .fill', bar_container).each(function () {
|
$('.meter .fill', barContainer).each(function () {
|
||||||
meter_fill_array.push($(this));
|
meterFillArray.push($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
var meter_label_array = [];
|
const meterLabelArray = [];
|
||||||
$('.meter', bar_container).each(function () {
|
$('.meter', barContainer).each(function () {
|
||||||
meter_label_array.push($('.label' , this));
|
meterLabelArray.push($('.label' , this));
|
||||||
});
|
});
|
||||||
|
|
||||||
// correct inner label margin on window resize (i don't know how we could do this in css)
|
// correct inner label margin on window resize (i don't know how we could do this in css)
|
||||||
tab.resize = function () {
|
tab.resize = function () {
|
||||||
var containerWidth = $('.meter:first', bar_container).width(),
|
const containerWidth = $('.meter:first', barContainer).width(),
|
||||||
labelWidth = $('.meter .label:first', bar_container).width(),
|
labelWidth = $('.meter .label:first', barContainer).width(),
|
||||||
margin = (containerWidth / 2) - (labelWidth / 2);
|
margin = (containerWidth / 2) - (labelWidth / 2);
|
||||||
|
|
||||||
for (var i = 0; i < meter_label_array.length; i++) {
|
for (let i = 0; i < meterLabelArray.length; i++) {
|
||||||
meter_label_array[i].css('margin-left', margin);
|
meterLabelArray[i].css('margin-left', margin);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).on('resize', tab.resize).resize(); // trigger so labels get correctly aligned on creation
|
$(window).on('resize', tab.resize).resize(); // trigger so labels get correctly aligned on creation
|
||||||
|
|
||||||
// handle rcmap & rssi aux channel
|
// handle rcmap & rssi aux channel
|
||||||
var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
let rcMapLetters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
||||||
|
|
||||||
var strBuffer = [];
|
let strBuffer = [];
|
||||||
for (var i = 0; i < FC.RC_MAP.length; i++) {
|
for (let i = 0; i < FC.RC_MAP.length; i++) {
|
||||||
strBuffer[FC.RC_MAP[i]] = RC_MAP_Letters[i];
|
strBuffer[FC.RC_MAP[i]] = rcMapLetters[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconstruct
|
// reconstruct
|
||||||
var str = strBuffer.join('');
|
const str = strBuffer.join('');
|
||||||
|
|
||||||
// set current value
|
// set current value
|
||||||
$('input[name="rcmap"]').val(str);
|
$('input[name="rcmap"]').val(str);
|
||||||
|
|
||||||
// validation / filter
|
// validation / filter
|
||||||
var last_valid = str;
|
const lastValid = str;
|
||||||
|
|
||||||
$('input[name="rcmap"]').on('input', function () {
|
$('input[name="rcmap"]').on('input', function () {
|
||||||
var val = $(this).val();
|
let val = $(this).val();
|
||||||
|
|
||||||
// limit length to max 8
|
// limit length to max 8
|
||||||
if (val.length > 8) {
|
if (val.length > 8) {
|
||||||
|
@ -188,26 +189,26 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[name="rcmap"]').focusout(function () {
|
$('input[name="rcmap"]').focusout(function () {
|
||||||
var val = $(this).val(),
|
const val = $(this).val();
|
||||||
strBuffer = val.split(''),
|
strBuffer = val.split('');
|
||||||
duplicityBuffer = [];
|
const duplicityBuffer = [];
|
||||||
|
|
||||||
if (val.length != 8) {
|
if (val.length != 8) {
|
||||||
$(this).val(last_valid);
|
$(this).val(lastValid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if characters inside are all valid, also check for duplicity
|
// check if characters inside are all valid, also check for duplicity
|
||||||
for (var i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
if (RC_MAP_Letters.indexOf(strBuffer[i]) < 0) {
|
if (rcMapLetters.indexOf(strBuffer[i]) < 0) {
|
||||||
$(this).val(last_valid);
|
$(this).val(lastValid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duplicityBuffer.indexOf(strBuffer[i]) < 0) {
|
if (duplicityBuffer.indexOf(strBuffer[i]) < 0) {
|
||||||
duplicityBuffer.push(strBuffer[i]);
|
duplicityBuffer.push(strBuffer[i]);
|
||||||
} else {
|
} else {
|
||||||
$(this).val(last_valid);
|
$(this).val(lastValid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,17 +221,15 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// rssi
|
// rssi
|
||||||
var rssi_channel_e = $('select[name="rssi_channel"]');
|
const rssi_channel_e = $('select[name="rssi_channel"]');
|
||||||
rssi_channel_e.append('<option value="0">' + i18n.getMessage("receiverRssiChannelDisabledOption") + '</option>');
|
rssi_channel_e.append(`<option value="0">${i18n.getMessage("receiverRssiChannelDisabledOption")}</option>`);
|
||||||
//1-4 reserved for Roll Pitch Yaw & Throttle, starting at 5
|
//1-4 reserved for Roll Pitch Yaw & Throttle, starting at 5
|
||||||
for (var i = 5; i < FC.RC.active_channels + 1; i++) {
|
for (let i = 5; i < FC.RC.active_channels + 1; i++) {
|
||||||
rssi_channel_e.append('<option value="' + i + '">' + i18n.getMessage("controlAxisAux" + (i-4)) + '</option>');
|
rssi_channel_e.append(`<option value="${i}">${i18n.getMessage("controlAxisAux" + (i-4))}</option>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('select[name="rssi_channel"]').val(FC.RSSI_CONFIG.channel);
|
$('select[name="rssi_channel"]').val(FC.RSSI_CONFIG.channel);
|
||||||
|
|
||||||
var rateHeight = TABS.receiver.rateChartHeight;
|
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
$('a.refresh').click(function () {
|
$('a.refresh').click(function () {
|
||||||
tab.refresh(function () {
|
tab.refresh(function () {
|
||||||
|
@ -249,11 +248,11 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch rc map
|
// catch rc map
|
||||||
var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
rcMapLetters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
||||||
var strBuffer = $('input[name="rcmap"]').val().split('');
|
strBuffer = $('input[name="rcmap"]').val().split('');
|
||||||
|
|
||||||
for (var i = 0; i < FC.RC_MAP.length; i++) {
|
for (let i = 0; i < FC.RC_MAP.length; i++) {
|
||||||
FC.RC_MAP[i] = strBuffer.indexOf(RC_MAP_Letters[i]);
|
FC.RC_MAP[i] = strBuffer.indexOf(rcMapLetters[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch rssi aux
|
// catch rssi aux
|
||||||
|
@ -282,20 +281,20 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_rc_configs() {
|
function save_rc_configs() {
|
||||||
var next_callback = save_rx_config;
|
const nextCallback = save_rx_config;
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, nextCallback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
nextCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_rx_config() {
|
function save_rx_config() {
|
||||||
var next_callback = save_to_eeprom;
|
const nextCallback = save_to_eeprom;
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, nextCallback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
nextCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,9 +308,8 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("a.sticks").click(function() {
|
$("a.sticks").click(function() {
|
||||||
var
|
const windowWidth = 370;
|
||||||
windowWidth = 370,
|
const windowHeight = 510;
|
||||||
windowHeight = 510;
|
|
||||||
|
|
||||||
chrome.app.window.create("/tabs/receiver_msp.html", {
|
chrome.app.window.create("/tabs/receiver_msp.html", {
|
||||||
id: "receiver_msp",
|
id: "receiver_msp",
|
||||||
|
@ -353,7 +351,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_40)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_40)) {
|
||||||
$('.tab-receiver .rcSmoothing').show();
|
$('.tab-receiver .rcSmoothing').show();
|
||||||
|
|
||||||
var rc_smoothing_protocol_e = $('select[name="rcSmoothing-select"]');
|
const rc_smoothing_protocol_e = $('select[name="rcSmoothing-select"]');
|
||||||
rc_smoothing_protocol_e.change(function () {
|
rc_smoothing_protocol_e.change(function () {
|
||||||
FC.RX_CONFIG.rcSmoothingType = $(this).val();
|
FC.RX_CONFIG.rcSmoothingType = $(this).val();
|
||||||
updateInterpolationView();
|
updateInterpolationView();
|
||||||
|
@ -398,16 +396,16 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
var rc_smoothing_derivative_type = $('select[name="rcSmoothingDerivativeType-select"]');
|
const rcSmoothingDerivativeType = $('select[name="rcSmoothingDerivativeType-select"]');
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||||
rc_smoothing_derivative_type.append($(`<option value="3">${i18n.getMessage("receiverRcSmoothingDerivativeTypeAuto")}</option>`));
|
rcSmoothingDerivativeType.append($(`<option value="3">${i18n.getMessage("receiverRcSmoothingDerivativeTypeAuto")}</option>`));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_smoothing_derivative_type.val(FC.RX_CONFIG.rcSmoothingDerivativeType);
|
rcSmoothingDerivativeType.val(FC.RX_CONFIG.rcSmoothingDerivativeType);
|
||||||
var rc_smoothing_channels = $('select[name="rcSmoothingChannels-select"]');
|
const rcSmoothingChannels = $('select[name="rcSmoothingChannels-select"]');
|
||||||
rc_smoothing_channels.val(FC.RX_CONFIG.rcInterpolationChannels);
|
rcSmoothingChannels.val(FC.RX_CONFIG.rcInterpolationChannels);
|
||||||
var rc_smoothing_input_type = $('select[name="rcSmoothingInputType-select"]');
|
const rcSmoothingInputType = $('select[name="rcSmoothingInputType-select"]');
|
||||||
rc_smoothing_input_type.val(FC.RX_CONFIG.rcSmoothingInputType);
|
rcSmoothingInputType.val(FC.RX_CONFIG.rcSmoothingInputType);
|
||||||
|
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||||
$('select[name="rcSmoothing-input-manual-select"], select[name="rcSmoothing-input-derivative-select"]').change(function() {
|
$('select[name="rcSmoothing-input-manual-select"], select[name="rcSmoothing-input-derivative-select"]').change(function() {
|
||||||
|
@ -419,8 +417,8 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
$('select[name="rcSmoothing-input-manual-select"]').change();
|
$('select[name="rcSmoothing-input-manual-select"]').change();
|
||||||
|
|
||||||
var rc_smoothing_auto_smoothness = $('input[name="rcSmoothingAutoSmoothness-number"]');
|
const rcSmoothingAutoSmoothness = $('input[name="rcSmoothingAutoSmoothness-number"]');
|
||||||
rc_smoothing_auto_smoothness.val(FC.RX_CONFIG.rcSmoothingAutoSmoothness);
|
rcSmoothingAutoSmoothness.val(FC.RX_CONFIG.rcSmoothingAutoSmoothness);
|
||||||
} else {
|
} else {
|
||||||
$('.tab-receiver .rcSmoothing-auto-smoothness').hide();
|
$('.tab-receiver .rcSmoothing-auto-smoothness').hide();
|
||||||
}
|
}
|
||||||
|
@ -475,21 +473,21 @@ TABS.receiver.initialize = function (callback) {
|
||||||
// save update rate
|
// save update rate
|
||||||
ConfigStorage.set({'rx_refresh_rate': plotUpdateRate});
|
ConfigStorage.set({'rx_refresh_rate': plotUpdateRate});
|
||||||
|
|
||||||
function get_rc_data() {
|
function get_rc_refresh_data() {
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup plot
|
// setup plot
|
||||||
var RX_plot_data = new Array(FC.RC.active_channels);
|
const rxPlotData = new Array(FC.RC.active_channels);
|
||||||
for (var i = 0; i < RX_plot_data.length; i++) {
|
for (let i = 0; i < rxPlotData.length; i++) {
|
||||||
RX_plot_data[i] = [];
|
rxPlotData[i] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var samples = 0,
|
let samples = 0;
|
||||||
svg = d3.select("svg"),
|
const svg = d3.select("svg");
|
||||||
RX_plot_e = $('#RX_plot'),
|
const RX_plot_e = $('#RX_plot');
|
||||||
margin = {top: 20, right: 0, bottom: 10, left: 40},
|
const margin = {top: 20, right: 0, bottom: 10, left: 40};
|
||||||
width, height, widthScale, heightScale;
|
let width, height, widthScale, heightScale;
|
||||||
|
|
||||||
function update_receiver_plot_size() {
|
function update_receiver_plot_size() {
|
||||||
width = RX_plot_e.width() - margin.left - margin.right;
|
width = RX_plot_e.width() - margin.left - margin.right;
|
||||||
|
@ -504,9 +502,9 @@ TABS.receiver.initialize = function (callback) {
|
||||||
if (FC.RC.active_channels > 0) {
|
if (FC.RC.active_channels > 0) {
|
||||||
|
|
||||||
// update bars with latest data
|
// update bars with latest data
|
||||||
for (var i = 0; i < FC.RC.active_channels; i++) {
|
for (let i = 0; i < FC.RC.active_channels; i++) {
|
||||||
meter_fill_array[i].css('width', ((FC.RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
meterFillArray[i].css('width', ((FC.RC.channels[i] - meterScale.min) / (meterScale.max - meterScale.min) * 100).clamp(0, 100) + '%');
|
||||||
meter_label_array[i].text(FC.RC.channels[i]);
|
meterLabelArray[i].text(FC.RC.channels[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
labelsChannelData.ch1[0].text(FC.RC.channels[0]);
|
labelsChannelData.ch1[0].text(FC.RC.channels[0]);
|
||||||
|
@ -515,14 +513,14 @@ TABS.receiver.initialize = function (callback) {
|
||||||
labelsChannelData.ch4[0].text(FC.RC.channels[3]);
|
labelsChannelData.ch4[0].text(FC.RC.channels[3]);
|
||||||
|
|
||||||
// push latest data to the main array
|
// push latest data to the main array
|
||||||
for (var i = 0; i < FC.RC.active_channels; i++) {
|
for (let i = 0; i < FC.RC.active_channels; i++) {
|
||||||
RX_plot_data[i].push([samples, FC.RC.channels[i]]);
|
rxPlotData[i].push([samples, FC.RC.channels[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove old data from array
|
// Remove old data from array
|
||||||
while (RX_plot_data[0].length > 300) {
|
while (rxPlotData[0].length > 300) {
|
||||||
for (var i = 0; i < RX_plot_data.length; i++) {
|
for (let i = 0; i < rxPlotData.length; i++) {
|
||||||
RX_plot_data[i].shift();
|
rxPlotData[i].shift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,29 +535,29 @@ TABS.receiver.initialize = function (callback) {
|
||||||
|
|
||||||
update_receiver_plot_size();
|
update_receiver_plot_size();
|
||||||
|
|
||||||
var xGrid = d3.svg.axis().
|
const xGrid = d3.svg.axis().
|
||||||
scale(widthScale).
|
scale(widthScale).
|
||||||
orient("bottom").
|
orient("bottom").
|
||||||
tickSize(-height, 0, 0).
|
tickSize(-height, 0, 0).
|
||||||
tickFormat("");
|
tickFormat("");
|
||||||
|
|
||||||
var yGrid = d3.svg.axis().
|
const yGrid = d3.svg.axis().
|
||||||
scale(heightScale).
|
scale(heightScale).
|
||||||
orient("left").
|
orient("left").
|
||||||
tickSize(-width, 0, 0).
|
tickSize(-width, 0, 0).
|
||||||
tickFormat("");
|
tickFormat("");
|
||||||
|
|
||||||
var xAxis = d3.svg.axis().
|
const xAxis = d3.svg.axis().
|
||||||
scale(widthScale).
|
scale(widthScale).
|
||||||
orient("bottom").
|
orient("bottom").
|
||||||
tickFormat(function (d) {return d;});
|
tickFormat(function (d) {return d;});
|
||||||
|
|
||||||
var yAxis = d3.svg.axis().
|
const yAxis = d3.svg.axis().
|
||||||
scale(heightScale).
|
scale(heightScale).
|
||||||
orient("left").
|
orient("left").
|
||||||
tickFormat(function (d) {return d;});
|
tickFormat(function (d) {return d;});
|
||||||
|
|
||||||
var line = d3.svg.line().
|
const line = d3.svg.line().
|
||||||
x(function (d) {return widthScale(d[0]);}).
|
x(function (d) {return widthScale(d[0]);}).
|
||||||
y(function (d) {return heightScale(d[1]);});
|
y(function (d) {return heightScale(d[1]);});
|
||||||
|
|
||||||
|
@ -568,9 +566,9 @@ TABS.receiver.initialize = function (callback) {
|
||||||
svg.select(".x.axis").call(xAxis);
|
svg.select(".x.axis").call(xAxis);
|
||||||
svg.select(".y.axis").call(yAxis);
|
svg.select(".y.axis").call(yAxis);
|
||||||
|
|
||||||
var data = svg.select("g.data"),
|
const data = svg.select("g.data");
|
||||||
lines = data.selectAll("path").data(RX_plot_data, function (d, i) {return i;}),
|
const lines = data.selectAll("path").data(rxPlotData, function (d, i) {return i;});
|
||||||
newLines = lines.enter().append("path").attr("class", "line");
|
lines.enter().append("path").attr("class", "line");
|
||||||
lines.attr('d', line);
|
lines.attr('d', line);
|
||||||
|
|
||||||
samples++;
|
samples++;
|
||||||
|
@ -580,7 +578,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
GUI.interval_remove('receiver_pull');
|
GUI.interval_remove('receiver_pull');
|
||||||
|
|
||||||
// enable RC data pulling
|
// enable RC data pulling
|
||||||
GUI.interval_add('receiver_pull', get_rc_data, plotUpdateRate, true);
|
GUI.interval_add('receiver_pull', get_rc_refresh_data, plotUpdateRate, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
ConfigStorage.get('rx_refresh_rate', function (result) {
|
ConfigStorage.get('rx_refresh_rate', function (result) {
|
||||||
|
@ -620,7 +618,7 @@ TABS.receiver.initModelPreview = function () {
|
||||||
this.useSuperExpo = true;
|
this.useSuperExpo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var useOldRateCurve = false;
|
let useOldRateCurve = false;
|
||||||
if (FC.CONFIG.flightControllerIdentifier == 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0')) {
|
if (FC.CONFIG.flightControllerIdentifier == 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0')) {
|
||||||
useOldRateCurve = true;
|
useOldRateCurve = true;
|
||||||
}
|
}
|
||||||
|
@ -639,9 +637,9 @@ TABS.receiver.renderModel = function () {
|
||||||
if (!this.clock) { this.clock = new THREE.Clock(); }
|
if (!this.clock) { this.clock = new THREE.Clock(); }
|
||||||
|
|
||||||
if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) {
|
if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) {
|
||||||
var delta = this.clock.getDelta();
|
const delta = this.clock.getDelta();
|
||||||
|
|
||||||
var roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[0], FC.RC_TUNING.roll_rate, FC.RC_TUNING.RC_RATE, FC.RC_TUNING.RC_EXPO, this.useSuperExpo, this.deadband, FC.RC_TUNING.roll_rate_limit),
|
const roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[0], FC.RC_TUNING.roll_rate, FC.RC_TUNING.RC_RATE, FC.RC_TUNING.RC_EXPO, this.useSuperExpo, this.deadband, FC.RC_TUNING.roll_rate_limit),
|
||||||
pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[1], FC.RC_TUNING.pitch_rate, FC.RC_TUNING.rcPitchRate, FC.RC_TUNING.RC_PITCH_EXPO, this.useSuperExpo, this.deadband, FC.RC_TUNING.pitch_rate_limit),
|
pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[1], FC.RC_TUNING.pitch_rate, FC.RC_TUNING.rcPitchRate, FC.RC_TUNING.RC_PITCH_EXPO, this.useSuperExpo, this.deadband, FC.RC_TUNING.pitch_rate_limit),
|
||||||
yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[2], FC.RC_TUNING.yaw_rate, FC.RC_TUNING.rcYawRate, FC.RC_TUNING.RC_YAW_EXPO, this.useSuperExpo, this.yawDeadband, FC.RC_TUNING.yaw_rate_limit);
|
yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[2], FC.RC_TUNING.yaw_rate, FC.RC_TUNING.rcYawRate, FC.RC_TUNING.RC_YAW_EXPO, this.useSuperExpo, this.yawDeadband, FC.RC_TUNING.yaw_rate_limit);
|
||||||
|
|
||||||
|
@ -663,7 +661,7 @@ TABS.receiver.cleanup = function (callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.receiver.refresh = function (callback) {
|
TABS.receiver.refresh = function (callback) {
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
GUI.tab_switch_cleanup(function () {
|
GUI.tab_switch_cleanup(function () {
|
||||||
self.initialize();
|
self.initialize();
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let css_dark = [
|
const css_dark = [
|
||||||
'/css/dark-theme.css'
|
'/css/dark-theme.css',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const CHANNEL_MIN_VALUE = 1000;
|
||||||
var
|
const CHANNEL_MID_VALUE = 1500;
|
||||||
CHANNEL_MIN_VALUE = 1000,
|
const CHANNEL_MAX_VALUE = 2000;
|
||||||
CHANNEL_MID_VALUE = 1500,
|
|
||||||
CHANNEL_MAX_VALUE = 2000,
|
|
||||||
|
|
||||||
// What's the index of each channel in the MSP channel list?
|
// What's the index of each channel in the MSP channel list?
|
||||||
channelMSPIndexes = {
|
const channelMSPIndexes = {
|
||||||
Roll: 0,
|
Roll: 0,
|
||||||
Pitch: 1,
|
Pitch: 1,
|
||||||
Throttle: 2,
|
Throttle: 2,
|
||||||
|
@ -20,10 +18,10 @@ var
|
||||||
Aux2: 5,
|
Aux2: 5,
|
||||||
Aux3: 6,
|
Aux3: 6,
|
||||||
Aux4: 7,
|
Aux4: 7,
|
||||||
},
|
};
|
||||||
|
|
||||||
// Set reasonable initial stick positions (Mode 2)
|
// Set reasonable initial stick positions (Mode 2)
|
||||||
stickValues = {
|
const stickValues = {
|
||||||
Throttle: CHANNEL_MIN_VALUE,
|
Throttle: CHANNEL_MIN_VALUE,
|
||||||
Pitch: CHANNEL_MID_VALUE,
|
Pitch: CHANNEL_MID_VALUE,
|
||||||
Roll: CHANNEL_MID_VALUE,
|
Roll: CHANNEL_MID_VALUE,
|
||||||
|
@ -31,24 +29,23 @@ var
|
||||||
Aux1: CHANNEL_MIN_VALUE,
|
Aux1: CHANNEL_MIN_VALUE,
|
||||||
Aux2: CHANNEL_MIN_VALUE,
|
Aux2: CHANNEL_MIN_VALUE,
|
||||||
Aux3: CHANNEL_MIN_VALUE,
|
Aux3: CHANNEL_MIN_VALUE,
|
||||||
Aux4: CHANNEL_MIN_VALUE
|
Aux4: CHANNEL_MIN_VALUE,
|
||||||
},
|
};
|
||||||
|
|
||||||
// First the vertical axis, then the horizontal:
|
// First the vertical axis, then the horizontal:
|
||||||
gimbals = [
|
const gimbals = [
|
||||||
["Throttle", "Yaw"],
|
["Throttle", "Yaw"],
|
||||||
["Pitch", "Roll"],
|
["Pitch", "Roll"],
|
||||||
],
|
];
|
||||||
|
|
||||||
gimbalElems,
|
let gimbalElems;
|
||||||
sliderElems,
|
let sliderElems;
|
||||||
|
let enableTX = false;
|
||||||
enableTX = false;
|
|
||||||
|
|
||||||
// This is a hack to get the i18n var of the parent, but the localizePage not works
|
// This is a hack to get the i18n var of the parent, but the localizePage not works
|
||||||
const i18n = opener.i18n;
|
const i18n = opener.i18n;
|
||||||
|
|
||||||
let watchers = {
|
const watchers = {
|
||||||
darkTheme: (val) => {
|
darkTheme: (val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
applyDarkTheme();
|
applyDarkTheme();
|
||||||
|
@ -60,7 +57,7 @@ let watchers = {
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('[i18n]:not(.i18n-replaced)').each(function() {
|
$('[i18n]:not(.i18n-replaced)').each(function() {
|
||||||
var element = $(this);
|
const element = $(this);
|
||||||
|
|
||||||
element.html(i18n.getMessage(element.attr('i18n')));
|
element.html(i18n.getMessage(element.attr('i18n')));
|
||||||
element.addClass('i18n-replaced');
|
element.addClass('i18n-replaced');
|
||||||
|
@ -70,14 +67,13 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
function transmitChannels() {
|
function transmitChannels() {
|
||||||
var
|
const channelValues = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
channelValues = [0, 0, 0, 0, 0, 0, 0, 0];
|
|
||||||
|
|
||||||
if (!enableTX) {
|
if (!enableTX) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var stickName in stickValues) {
|
for (const stickName in stickValues) {
|
||||||
channelValues[channelMSPIndexes[stickName]] = stickValues[stickName];
|
channelValues[channelMSPIndexes[stickName]] = stickValues[stickName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,14 +95,12 @@ function channelValueToStickPortion(channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateControlPositions() {
|
function updateControlPositions() {
|
||||||
for (var stickName in stickValues) {
|
for (const stickName in stickValues) {
|
||||||
var
|
const stickValue = stickValues[stickName];
|
||||||
stickValue = stickValues[stickName];
|
|
||||||
|
|
||||||
// Look for the gimbal which corresponds to this stick name
|
// Look for the gimbal which corresponds to this stick name
|
||||||
for (var gimbalIndex in gimbals) {
|
for (const gimbalIndex in gimbals) {
|
||||||
var
|
const gimbal = gimbals[gimbalIndex],
|
||||||
gimbal = gimbals[gimbalIndex],
|
|
||||||
gimbalElem = gimbalElems.get(gimbalIndex),
|
gimbalElem = gimbalElems.get(gimbalIndex),
|
||||||
gimbalSize = $(gimbalElem).width(),
|
gimbalSize = $(gimbalElem).width(),
|
||||||
stickElem = $(".control-stick", gimbalElem);
|
stickElem = $(".control-stick", gimbalElem);
|
||||||
|
@ -123,8 +117,7 @@ function updateControlPositions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleGimbalMouseDrag(e) {
|
function handleGimbalMouseDrag(e) {
|
||||||
var
|
const gimbal = $(gimbalElems.get(e.data.gimbalIndex)),
|
||||||
gimbal = $(gimbalElems.get(e.data.gimbalIndex)),
|
|
||||||
gimbalOffset = gimbal.offset(),
|
gimbalOffset = gimbal.offset(),
|
||||||
gimbalSize = gimbal.width();
|
gimbalSize = gimbal.width();
|
||||||
|
|
||||||
|
@ -135,31 +128,29 @@ function handleGimbalMouseDrag(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function localizeAxisNames() {
|
function localizeAxisNames() {
|
||||||
for (var gimbalIndex in gimbals) {
|
for (const gimbalIndex in gimbals) {
|
||||||
var
|
const gimbal = gimbalElems.get(gimbalIndex);
|
||||||
gimbal = gimbalElems.get(gimbalIndex);
|
|
||||||
|
|
||||||
$(".gimbal-label-vert", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][0]));
|
$(".gimbal-label-vert", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][0]));
|
||||||
$(".gimbal-label-horz", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
|
$(".gimbal-label-horz", gimbal).text(i18n.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var sliderIndex = 0; sliderIndex < 4; sliderIndex++) {
|
for (let sliderIndex = 0; sliderIndex < 4; sliderIndex++) {
|
||||||
$(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage("controlAxisAux" + (sliderIndex + 1)));
|
$(".slider-label", sliderElems.get(sliderIndex)).text(i18n.getMessage("controlAxisAux" + (sliderIndex + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyDarkTheme() {
|
function applyDarkTheme() {
|
||||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', false));
|
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', false));
|
||||||
};
|
}
|
||||||
|
|
||||||
function applyNormalTheme() {
|
function applyNormalTheme() {
|
||||||
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', true));
|
css_dark.forEach((el) => $('link[href="' + el + '"]').prop('disabled', true));
|
||||||
};
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".button-enable .btn").click(function() {
|
$(".button-enable .btn").click(function() {
|
||||||
var
|
const shrinkHeight = $(".warning").height();
|
||||||
shrinkHeight = $(".warning").height();
|
|
||||||
|
|
||||||
$(".warning").slideUp("short", function() {
|
$(".warning").slideUp("short", function() {
|
||||||
chrome.app.window.current().innerBounds.minHeight -= shrinkHeight;
|
chrome.app.window.current().innerBounds.minHeight -= shrinkHeight;
|
||||||
|
@ -184,8 +175,7 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".slider", sliderElems).each(function(sliderIndex) {
|
$(".slider", sliderElems).each(function(sliderIndex) {
|
||||||
var
|
const initialValue = stickValues[`Aux${sliderIndex + 1}`];
|
||||||
initialValue = stickValues["Aux" + (sliderIndex + 1)];
|
|
||||||
|
|
||||||
$(this)
|
$(this)
|
||||||
.noUiSlider({
|
.noUiSlider({
|
||||||
|
@ -197,7 +187,7 @@ $(document).ready(function() {
|
||||||
}).on('slide change set', function(e, value) {
|
}).on('slide change set', function(e, value) {
|
||||||
value = Math.round(parseFloat(value));
|
value = Math.round(parseFloat(value));
|
||||||
|
|
||||||
stickValues["Aux" + (sliderIndex + 1)] = value;
|
stickValues[`Aux${(sliderIndex + 1)}`] = value;
|
||||||
|
|
||||||
$(".tooltip", this).text(value);
|
$(".tooltip", this).text(value);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue