mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-19 06:15:13 +03:00
Bump API_VERSION_ACCEPTED and semver cleanup (#3104)
Firmware flasher: build config help icons style fix (#3092) Co-authored-by: Ivan Efimov <gendalf44@yandex.ru>
This commit is contained in:
parent
7df8d627e9
commit
867b59d204
31 changed files with 1702 additions and 4113 deletions
|
@ -58,21 +58,11 @@ receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_rc_configs() {
|
||||
const nextCallback = load_rx_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, nextCallback);
|
||||
} else {
|
||||
nextCallback();
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, load_rx_config);
|
||||
}
|
||||
|
||||
function load_rx_config() {
|
||||
const nextCallback = load_mixer_config;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, nextCallback);
|
||||
} else {
|
||||
nextCallback();
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, load_mixer_config);
|
||||
}
|
||||
|
||||
function load_mixer_config() {
|
||||
|
@ -95,32 +85,20 @@ receiver.initialize = function (callback) {
|
|||
// translate to user-selected language
|
||||
i18n.localizePage();
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
$('.deadband').hide();
|
||||
} else {
|
||||
$('.deadband input[name="yaw_deadband"]').val(FC.RC_DEADBAND_CONFIG.yaw_deadband);
|
||||
$('.deadband input[name="deadband"]').val(FC.RC_DEADBAND_CONFIG.deadband);
|
||||
$('.deadband input[name="3ddeadbandthrottle"]').val(FC.RC_DEADBAND_CONFIG.deadband3d_throttle);
|
||||
}
|
||||
$('.deadband input[name="yaw_deadband"]').val(FC.RC_DEADBAND_CONFIG.yaw_deadband);
|
||||
$('.deadband input[name="deadband"]').val(FC.RC_DEADBAND_CONFIG.deadband);
|
||||
$('.deadband input[name="3ddeadbandthrottle"]').val(FC.RC_DEADBAND_CONFIG.deadband3d_throttle);
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
$('.sticks').hide();
|
||||
} else {
|
||||
$('.sticks input[name="stick_min"]').val(FC.RX_CONFIG.stick_min);
|
||||
$('.sticks input[name="stick_center"]').val(FC.RX_CONFIG.stick_center);
|
||||
$('.sticks input[name="stick_max"]').val(FC.RX_CONFIG.stick_max);
|
||||
}
|
||||
$('.sticks input[name="stick_min"]').val(FC.RX_CONFIG.stick_min);
|
||||
$('.sticks input[name="stick_center"]').val(FC.RX_CONFIG.stick_center);
|
||||
$('.sticks input[name="stick_max"]').val(FC.RX_CONFIG.stick_max);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
$('select[name="rcInterpolation-select"]').val(FC.RX_CONFIG.rcInterpolation);
|
||||
$('input[name="rcInterpolationInterval-number"]').val(FC.RX_CONFIG.rcInterpolationInterval);
|
||||
$('select[name="rcInterpolation-select"]').val(FC.RX_CONFIG.rcInterpolation);
|
||||
$('input[name="rcInterpolationInterval-number"]').val(FC.RX_CONFIG.rcInterpolationInterval);
|
||||
|
||||
$('select[name="rcInterpolation-select"]').change(function () {
|
||||
tab.updateRcInterpolationParameters();
|
||||
}).change();
|
||||
} else {
|
||||
$('.tab-receiver div.rcInterpolation').hide();
|
||||
}
|
||||
$('select[name="rcInterpolation-select"]').change(function () {
|
||||
tab.updateRcInterpolationParameters();
|
||||
}).change();
|
||||
|
||||
// generate bars
|
||||
const bar_names = [
|
||||
|
@ -289,108 +267,96 @@ receiver.initialize = function (callback) {
|
|||
});
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_31)) {
|
||||
const spiRxTypes = [
|
||||
'NRF24_V202_250K',
|
||||
'NRF24_V202_1M',
|
||||
'NRF24_SYMA_X',
|
||||
'NRF24_SYMA_X5C',
|
||||
'NRF24_CX10',
|
||||
'CX10A',
|
||||
'NRF24_H8_3D',
|
||||
'NRF24_INAV',
|
||||
'FRSKY_D',
|
||||
];
|
||||
const spiRxTypes = [
|
||||
'NRF24_V202_250K',
|
||||
'NRF24_V202_1M',
|
||||
'NRF24_SYMA_X',
|
||||
'NRF24_SYMA_X5C',
|
||||
'NRF24_CX10',
|
||||
'CX10A',
|
||||
'NRF24_H8_3D',
|
||||
'NRF24_INAV',
|
||||
'FRSKY_D',
|
||||
'FRSKY_X',
|
||||
'A7105_FLYSKY',
|
||||
'A7105_FLYSKY_2A',
|
||||
'NRF24_KN',
|
||||
'SFHSS',
|
||||
'SPEKTRUM',
|
||||
'FRSKY_X_LBT',
|
||||
];
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_37)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X',
|
||||
'A7105_FLYSKY',
|
||||
'A7105_FLYSKY_2A',
|
||||
'NRF24_KN',
|
||||
);
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
spiRxTypes.push(
|
||||
'REDPINE',
|
||||
);
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X_V2',
|
||||
'FRSKY_X_LBT_V2',
|
||||
'EXPRESSLRS',
|
||||
);
|
||||
}
|
||||
|
||||
const spiRxElement = $('select.spiRx');
|
||||
for (let i = 0; i < spiRxTypes.length; i++) {
|
||||
spiRxElement.append(`<option value="${i}">${spiRxTypes[i]}</option>`);
|
||||
}
|
||||
|
||||
spiRxElement.change(function () {
|
||||
const value = parseInt($(this).val());
|
||||
|
||||
let newValue = undefined;
|
||||
if (value !== FC.RX_CONFIG.rxSpiProtocol) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
updateSaveButton(true);
|
||||
}
|
||||
tab.analyticsChanges['SPIRXProtocol'] = newValue;
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||
spiRxTypes.push(
|
||||
'SFHSS',
|
||||
'SPEKTRUM',
|
||||
'FRSKY_X_LBT',
|
||||
);
|
||||
}
|
||||
FC.RX_CONFIG.rxSpiProtocol = value;
|
||||
});
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
spiRxTypes.push(
|
||||
'REDPINE',
|
||||
);
|
||||
}
|
||||
// select current serial RX type
|
||||
spiRxElement.val(FC.RX_CONFIG.rxSpiProtocol);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
spiRxTypes.push(
|
||||
'FRSKY_X_V2',
|
||||
'FRSKY_X_LBT_V2',
|
||||
'EXPRESSLRS',
|
||||
);
|
||||
}
|
||||
|
||||
const spiRxElement = $('select.spiRx');
|
||||
for (let i = 0; i < spiRxTypes.length; i++) {
|
||||
spiRxElement.append(`<option value="${i}">${spiRxTypes[i]}</option>`);
|
||||
}
|
||||
|
||||
spiRxElement.change(function () {
|
||||
const value = parseInt($(this).val());
|
||||
|
||||
let newValue = undefined;
|
||||
if (value !== FC.RX_CONFIG.rxSpiProtocol) {
|
||||
newValue = $(this).find('option:selected').text();
|
||||
updateSaveButton(true);
|
||||
}
|
||||
tab.analyticsChanges['SPIRXProtocol'] = newValue;
|
||||
|
||||
FC.RX_CONFIG.rxSpiProtocol = value;
|
||||
if (!GUI.isCordova()) {
|
||||
// Convert to select2 and order alphabetic
|
||||
spiRxElement.select2({
|
||||
sorter(data) {
|
||||
return data.sort(function(a, b) {
|
||||
return a.text.localeCompare(b.text);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// select current serial RX type
|
||||
spiRxElement.val(FC.RX_CONFIG.rxSpiProtocol);
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI') && FC.RX_CONFIG.rxSpiProtocol == 19 && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
tab.elrsPassphraseEnabled = true;
|
||||
|
||||
if (!GUI.isCordova()) {
|
||||
// Convert to select2 and order alphabetic
|
||||
spiRxElement.select2({
|
||||
sorter(data) {
|
||||
return data.sort(function(a, b) {
|
||||
return a.text.localeCompare(b.text);
|
||||
});
|
||||
},
|
||||
});
|
||||
const elrsUid = $('span.elrsUid');
|
||||
const elrsUidString = FC.RX_CONFIG.elrsUid.join(',');
|
||||
|
||||
elrsUid.text(elrsUidString);
|
||||
|
||||
const elrsPassphrase = $('input.elrsPassphrase');
|
||||
|
||||
const passphraseString = lookup_elrs_passphrase(elrsUidString);
|
||||
if (passphraseString) {
|
||||
elrsPassphrase.val(passphraseString);
|
||||
}
|
||||
|
||||
if (FC.FEATURE_CONFIG.features.isEnabled('RX_SPI') && FC.RX_CONFIG.rxSpiProtocol == 19 && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45)) {
|
||||
tab.elrsPassphraseEnabled = true;
|
||||
|
||||
const elrsUid = $('span.elrsUid');
|
||||
const elrsUidString = FC.RX_CONFIG.elrsUid.join(',');
|
||||
|
||||
elrsUid.text(elrsUidString);
|
||||
|
||||
const elrsPassphrase = $('input.elrsPassphrase');
|
||||
|
||||
const passphraseString = lookup_elrs_passphrase(elrsUidString);
|
||||
if (passphraseString) {
|
||||
elrsPassphrase.val(passphraseString);
|
||||
elrsPassphrase.on('keyup', function() {
|
||||
const passphrase = elrsPassphrase.val();
|
||||
if (passphrase) {
|
||||
elrsUid.text(elrs_passphrase_to_bytes(passphrase));
|
||||
} else {
|
||||
elrsUid.text("0.0.0.0.0.0");
|
||||
}
|
||||
elrsPassphrase.on('keyup', function() {
|
||||
const passphrase = elrsPassphrase.val();
|
||||
if (passphrase) {
|
||||
elrsUid.text(elrs_passphrase_to_bytes(passphrase));
|
||||
} else {
|
||||
elrsUid.text("0.0.0.0.0.0");
|
||||
}
|
||||
updateSaveButton(true);
|
||||
});
|
||||
} else {
|
||||
tab.elrsPassphraseEnabled = false;
|
||||
}
|
||||
updateSaveButton(true);
|
||||
});
|
||||
} else {
|
||||
tab.elrsPassphraseEnabled = false;
|
||||
}
|
||||
|
||||
// UI Hooks
|
||||
|
@ -465,14 +431,12 @@ receiver.initialize = function (callback) {
|
|||
|
||||
function saveConfiguration(boot=false) {
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0")) {
|
||||
FC.RX_CONFIG.stick_max = parseInt($('.sticks input[name="stick_max"]').val());
|
||||
FC.RX_CONFIG.stick_center = parseInt($('.sticks input[name="stick_center"]').val());
|
||||
FC.RX_CONFIG.stick_min = parseInt($('.sticks input[name="stick_min"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.deadband = parseInt($('.deadband input[name="deadband"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.deadband3d_throttle = ($('.deadband input[name="3ddeadbandthrottle"]').val());
|
||||
}
|
||||
FC.RX_CONFIG.stick_max = parseInt($('.sticks input[name="stick_max"]').val());
|
||||
FC.RX_CONFIG.stick_center = parseInt($('.sticks input[name="stick_center"]').val());
|
||||
FC.RX_CONFIG.stick_min = parseInt($('.sticks input[name="stick_min"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.deadband = parseInt($('.deadband input[name="deadband"]').val());
|
||||
FC.RC_DEADBAND_CONFIG.deadband3d_throttle = ($('.deadband input[name="3ddeadbandthrottle"]').val());
|
||||
|
||||
// catch rc map
|
||||
rcMapLetters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
||||
|
@ -485,19 +449,14 @@ receiver.initialize = function (callback) {
|
|||
// catch rssi aux
|
||||
FC.RSSI_CONFIG.channel = parseInt($('select[name="rssi_channel"]').val());
|
||||
|
||||
FC.RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val());
|
||||
FC.RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val());
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
FC.RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val());
|
||||
FC.RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val());
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_40)) {
|
||||
FC.RX_CONFIG.rcSmoothingSetpointCutoff = parseInt($('input[name="rcSmoothingSetpointHz-number"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = parseInt($('input[name="rcSmoothingFeedforwardCutoff-number"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingDerivativeType = parseInt($('select[name="rcSmoothingFeedforwardType-select"]').val());
|
||||
FC.RX_CONFIG.rcInterpolationChannels = parseInt($('select[name="rcSmoothingChannels-select"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingInputType = parseInt($('select[name="rcSmoothingSetpointType-select"]').val());
|
||||
}
|
||||
FC.RX_CONFIG.rcSmoothingSetpointCutoff = parseInt($('input[name="rcSmoothingSetpointHz-number"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingFeedforwardCutoff = parseInt($('input[name="rcSmoothingFeedforwardCutoff-number"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingDerivativeType = parseInt($('select[name="rcSmoothingFeedforwardType-select"]').val());
|
||||
FC.RX_CONFIG.rcInterpolationChannels = parseInt($('select[name="rcSmoothingChannels-select"]').val());
|
||||
FC.RX_CONFIG.rcSmoothingInputType = parseInt($('select[name="rcSmoothingSetpointType-select"]').val());
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
FC.RX_CONFIG.rcSmoothingAutoFactor = parseInt($('input[name="rcSmoothingAutoFactor-number"]').val());
|
||||
|
@ -521,21 +480,12 @@ receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_rc_configs() {
|
||||
const nextCallback = save_rx_config;
|
||||
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, nextCallback);
|
||||
} else {
|
||||
nextCallback();
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, save_rx_config);
|
||||
}
|
||||
|
||||
function save_rx_config() {
|
||||
const nextCallback = (boot) ? save_feature_config : save_to_eeprom;
|
||||
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, nextCallback);
|
||||
} else {
|
||||
nextCallback();
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, nextCallback);
|
||||
}
|
||||
|
||||
function save_feature_config() {
|
||||
|
@ -613,105 +563,92 @@ receiver.initialize = function (callback) {
|
|||
$(".bind_btn").toggle(showBindButton);
|
||||
|
||||
// RC Smoothing
|
||||
const smoothingOnOff = ((semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) ?
|
||||
FC.RX_CONFIG.rcSmoothingMode : FC.RX_CONFIG.rcSmoothingType);
|
||||
const smoothingOnOff = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) ? FC.RX_CONFIG.rcSmoothingMode : FC.RX_CONFIG.rcSmoothingType;
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_40)) {
|
||||
$('.tab-receiver .rcSmoothing').show();
|
||||
|
||||
const rc_smoothing_protocol_e = $('select[name="rcSmoothing-select"]');
|
||||
rc_smoothing_protocol_e.change(function () {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
FC.RX_CONFIG.rcSmoothingMode = parseFloat($(this).val());
|
||||
} else {
|
||||
FC.RX_CONFIG.rcSmoothingType = parseFloat($(this).val());
|
||||
}
|
||||
updateInterpolationView();
|
||||
});
|
||||
rc_smoothing_protocol_e.val(smoothingOnOff);
|
||||
|
||||
const rcSmoothingNumberElement = $('input[name="rcSmoothingSetpointHz-number"]');
|
||||
const rcSmoothingFeedforwardNumberElement = $('input[name="rcSmoothingFeedforwardCutoff-number"]');
|
||||
rcSmoothingNumberElement.val(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
|
||||
rcSmoothingFeedforwardNumberElement.val(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').show();
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').val("1");
|
||||
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').hide();
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').val("0");
|
||||
}
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').change(function () {
|
||||
if ($(this).val() === "0") {
|
||||
rcSmoothingNumberElement.val(0);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').hide();
|
||||
}
|
||||
if ($(this).val() === "1") {
|
||||
rcSmoothingNumberElement.val(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').show();
|
||||
$('select[name="rcSmoothing-feedforward-select"]').val("1");
|
||||
if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0) {
|
||||
$('select[name="rcSmoothing-feedforward-select"]').val("0");
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').hide();
|
||||
}
|
||||
$('select[name="rcSmoothing-feedforward-select"]').change(function () {
|
||||
if ($(this).val() === "0") {
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').hide();
|
||||
rcSmoothingFeedforwardNumberElement.val(0);
|
||||
}
|
||||
if ($(this).val() === "1") {
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').show();
|
||||
rcSmoothingFeedforwardNumberElement.val(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
|
||||
}
|
||||
}).change();
|
||||
|
||||
const rcSmoothingFeedforwardType = $('select[name="rcSmoothingFeedforwardType-select"]');
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
rcSmoothingFeedforwardType.append($(`<option value="3">${i18n.getMessage("receiverRcSmoothingFeedforwardTypeAuto")}</option>`));
|
||||
}
|
||||
|
||||
rcSmoothingFeedforwardType.val(FC.RX_CONFIG.rcSmoothingDerivativeType);
|
||||
const rcSmoothingChannels = $('select[name="rcSmoothingChannels-select"]');
|
||||
rcSmoothingChannels.val(FC.RX_CONFIG.rcInterpolationChannels);
|
||||
const rcSmoothingSetpointType = $('select[name="rcSmoothingSetpointType-select"]');
|
||||
rcSmoothingSetpointType.val(FC.RX_CONFIG.rcSmoothingInputType);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"], select[name="rcSmoothing-feedforward-select"]').change(function() {
|
||||
if ($('select[name="rcSmoothing-setpoint-manual-select"]').val() === "0" || $('select[name="rcSmoothing-feedforward-select"]').val() === "0") {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').show();
|
||||
} else {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').hide();
|
||||
}
|
||||
});
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').change();
|
||||
|
||||
const rcSmoothingAutoFactor = $('input[name="rcSmoothingAutoFactor-number"]');
|
||||
rcSmoothingAutoFactor.val(FC.RX_CONFIG.rcSmoothingAutoFactor);
|
||||
} else {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').hide();
|
||||
}
|
||||
$('.tab-receiver .rcSmoothing').show();
|
||||
|
||||
const rc_smoothing_protocol_e = $('select[name="rcSmoothing-select"]');
|
||||
rc_smoothing_protocol_e.change(function () {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
$('.receiverRcSmoothingAutoFactorHelp').attr('title', i18n.getMessage("receiverRcSmoothingAutoFactorHelp2"));
|
||||
FC.RX_CONFIG.rcSmoothingMode = parseFloat($(this).val());
|
||||
} else {
|
||||
FC.RX_CONFIG.rcSmoothingType = parseFloat($(this).val());
|
||||
}
|
||||
|
||||
updateInterpolationView();
|
||||
} else {
|
||||
$('.tab-receiver .rcInterpolation').show();
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').hide();
|
||||
});
|
||||
rc_smoothing_protocol_e.val(smoothingOnOff);
|
||||
|
||||
const rcSmoothingNumberElement = $('input[name="rcSmoothingSetpointHz-number"]');
|
||||
const rcSmoothingFeedforwardNumberElement = $('input[name="rcSmoothingFeedforwardCutoff-number"]');
|
||||
rcSmoothingNumberElement.val(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
|
||||
rcSmoothingFeedforwardNumberElement.val(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').show();
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').val("1");
|
||||
if (FC.RX_CONFIG.rcSmoothingSetpointCutoff === 0) {
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').hide();
|
||||
$('.tab-receiver .rcSmoothing-feedforward-type').hide();
|
||||
$('.tab-receiver .rcSmoothing-setpoint-type').hide();
|
||||
$('.tab-receiver .rcSmoothing-feedforward-manual').hide();
|
||||
$('.tab-receiver .rcSmoothing-setpoint-manual').hide();
|
||||
$('.tab-receiver .rc-smoothing-type').hide();
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').val("0");
|
||||
}
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').change(function () {
|
||||
if ($(this).val() === "0") {
|
||||
rcSmoothingNumberElement.val(0);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').hide();
|
||||
}
|
||||
if ($(this).val() === "1") {
|
||||
rcSmoothingNumberElement.val(FC.RX_CONFIG.rcSmoothingSetpointCutoff);
|
||||
$('.tab-receiver .rcSmoothing-setpoint-cutoff').show();
|
||||
}
|
||||
}).change();
|
||||
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').show();
|
||||
$('select[name="rcSmoothing-feedforward-select"]').val("1");
|
||||
if (FC.RX_CONFIG.rcSmoothingFeedforwardCutoff === 0) {
|
||||
$('select[name="rcSmoothing-feedforward-select"]').val("0");
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').hide();
|
||||
}
|
||||
$('select[name="rcSmoothing-feedforward-select"]').change(function () {
|
||||
if ($(this).val() === "0") {
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').hide();
|
||||
rcSmoothingFeedforwardNumberElement.val(0);
|
||||
}
|
||||
if ($(this).val() === "1") {
|
||||
$('.tab-receiver .rcSmoothing-feedforward-cutoff').show();
|
||||
rcSmoothingFeedforwardNumberElement.val(FC.RX_CONFIG.rcSmoothingFeedforwardCutoff);
|
||||
}
|
||||
}).change();
|
||||
|
||||
const rcSmoothingFeedforwardType = $('select[name="rcSmoothingFeedforwardType-select"]');
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
|
||||
rcSmoothingFeedforwardType.append($(`<option value="3">${i18n.getMessage("receiverRcSmoothingFeedforwardTypeAuto")}</option>`));
|
||||
}
|
||||
|
||||
rcSmoothingFeedforwardType.val(FC.RX_CONFIG.rcSmoothingDerivativeType);
|
||||
const rcSmoothingChannels = $('select[name="rcSmoothingChannels-select"]');
|
||||
rcSmoothingChannels.val(FC.RX_CONFIG.rcInterpolationChannels);
|
||||
const rcSmoothingSetpointType = $('select[name="rcSmoothingSetpointType-select"]');
|
||||
rcSmoothingSetpointType.val(FC.RX_CONFIG.rcSmoothingInputType);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"], select[name="rcSmoothing-feedforward-select"]').change(function() {
|
||||
if ($('select[name="rcSmoothing-setpoint-manual-select"]').val() === "0" || $('select[name="rcSmoothing-feedforward-select"]').val() === "0") {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').show();
|
||||
} else {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').hide();
|
||||
}
|
||||
});
|
||||
$('select[name="rcSmoothing-setpoint-manual-select"]').change();
|
||||
|
||||
const rcSmoothingAutoFactor = $('input[name="rcSmoothingAutoFactor-number"]');
|
||||
rcSmoothingAutoFactor.val(FC.RX_CONFIG.rcSmoothingAutoFactor);
|
||||
} else {
|
||||
$('.tab-receiver .rcSmoothing-auto-factor').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
$('.receiverRcSmoothingAutoFactorHelp').attr('title', i18n.getMessage("receiverRcSmoothingAutoFactorHelp2"));
|
||||
}
|
||||
|
||||
updateInterpolationView();
|
||||
|
||||
// Only show the MSP control sticks if the MSP Rx feature is enabled
|
||||
$(".sticks_btn").toggle(FC.FEATURE_CONFIG.features.isEnabled('RX_MSP'));
|
||||
|
||||
|
@ -888,15 +825,7 @@ receiver.initModelPreview = function () {
|
|||
this.keepRendering = true;
|
||||
this.model = new Model($('.model_preview'), $('.model_preview canvas'));
|
||||
|
||||
let useOldRateCurve = false;
|
||||
const cleanFlight = FC.CONFIG.flightControllerIdentifier === 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0');
|
||||
const betaFlight = FC.CONFIG.flightControllerIdentifier === 'BTFL' && semver.lt(FC.CONFIG.flightControllerVersion, '2.8.0');
|
||||
|
||||
if (cleanFlight || betaFlight) {
|
||||
useOldRateCurve = true;
|
||||
}
|
||||
|
||||
this.rateCurve = new RateCurve(useOldRateCurve);
|
||||
this.rateCurve = new RateCurve(false);
|
||||
this.currentRates = this.rateCurve.getCurrentRates();
|
||||
|
||||
$(window).on('resize', $.bind(this.model.resize, this.model));
|
||||
|
@ -946,12 +875,10 @@ receiver.refresh = function (callback) {
|
|||
};
|
||||
|
||||
receiver.updateRcInterpolationParameters = function () {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
|
||||
if ($('select[name="rcInterpolation-select"]').val() === '3') {
|
||||
$('.tab-receiver .rc-interpolation-manual').show();
|
||||
} else {
|
||||
$('.tab-receiver .rc-interpolation-manual').hide();
|
||||
}
|
||||
if ($('select[name="rcInterpolation-select"]').val() === '3') {
|
||||
$('.tab-receiver .rc-interpolation-manual').show();
|
||||
} else {
|
||||
$('.tab-receiver .rc-interpolation-manual').hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue