Moved getSerialRxTypes to not interfere with backup/restore
parent
56e5299be3
commit
27a4849ddf
104
src/js/fc.js
104
src/js/fc.js
|
@ -543,58 +543,6 @@ const FC = {
|
|||
rcSmoothingDerivativeType: 0,
|
||||
rcSmoothingAutoSmoothness: 0,
|
||||
usbCdcHidType: 0,
|
||||
serialRxTypes: [
|
||||
'SPEKTRUM1024',
|
||||
'SPEKTRUM2048',
|
||||
'SBUS',
|
||||
'SUMD',
|
||||
'SUMH',
|
||||
'XBUS_MODE_B',
|
||||
'XBUS_MODE_B_RJ01',
|
||||
],
|
||||
|
||||
getSerialRxTypes: () => {
|
||||
const apiVersion = this.CONFIG.apiVersion;
|
||||
const flightControllerIdentifier = this.CONFIG.flightControllerIdentifier;
|
||||
const flightControllerVersion = this.CONFIG.flightControllerVersion;
|
||||
// js way of cloning an array
|
||||
const result = [...this.RX_CONFIG.serialRxTypes];
|
||||
|
||||
if (semver.gte(apiVersion, "1.15.0")) {
|
||||
result.push('IBUS');
|
||||
}
|
||||
|
||||
if ((flightControllerIdentifier === 'BTFL' && semver.gte(flightControllerVersion, "2.6.0")) ||
|
||||
(flightControllerIdentifier === 'CLFL' && semver.gte(apiVersion, API_VERSION_1_31))) {
|
||||
result.push('JETIEXBUS');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_31)) {
|
||||
result.push('CRSF');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, "1.24.0")) {
|
||||
result.push('SPEKTRUM2048/SRXL');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_35)) {
|
||||
result.push('TARGET_CUSTOM');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_37)) {
|
||||
result.push('FrSky FPort');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_42)) {
|
||||
result.push('SPEKTRUM SRXL2');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_44)) {
|
||||
result.push('IRC GHOST');
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
};
|
||||
|
||||
this.FAILSAFE_CONFIG = {
|
||||
|
@ -696,6 +644,58 @@ const FC = {
|
|||
];
|
||||
},
|
||||
|
||||
getSerialRxTypes: () => {
|
||||
const apiVersion = FC.CONFIG.apiVersion;
|
||||
const flightControllerIdentifier = FC.CONFIG.flightControllerIdentifier;
|
||||
const flightControllerVersion = FC.CONFIG.flightControllerVersion;
|
||||
|
||||
// defaults
|
||||
const serialRxTypes = [
|
||||
'SPEKTRUM1024',
|
||||
'SPEKTRUM2048',
|
||||
'SBUS',
|
||||
'SUMD',
|
||||
'SUMH',
|
||||
'XBUS_MODE_B',
|
||||
'XBUS_MODE_B_RJ01',
|
||||
];
|
||||
|
||||
if (semver.gte(apiVersion, "1.15.0")) {
|
||||
serialRxTypes.push('IBUS');
|
||||
}
|
||||
|
||||
if ((flightControllerIdentifier === 'BTFL' && semver.gte(flightControllerVersion, "2.6.0")) ||
|
||||
(flightControllerIdentifier === 'CLFL' && semver.gte(apiVersion, API_VERSION_1_31))) {
|
||||
serialRxTypes.push('JETIEXBUS');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_31)) {
|
||||
serialRxTypes.push('CRSF');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, "1.24.0")) {
|
||||
serialRxTypes.push('SPEKTRUM2048/SRXL');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_35)) {
|
||||
serialRxTypes.push('TARGET_CUSTOM');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_37)) {
|
||||
serialRxTypes.push('FrSky FPort');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_42)) {
|
||||
serialRxTypes.push('SPEKTRUM SRXL2');
|
||||
}
|
||||
|
||||
if (semver.gte(apiVersion, API_VERSION_1_44)) {
|
||||
serialRxTypes.push('IRC GHOST');
|
||||
}
|
||||
|
||||
return serialRxTypes;
|
||||
},
|
||||
|
||||
getHardwareName() {
|
||||
let name;
|
||||
if (this.CONFIG.targetName) {
|
||||
|
|
|
@ -844,7 +844,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
const serialRXSelectEl = $('select.serialRX');
|
||||
FC.RX_CONFIG.getSerialRxTypes().forEach((serialRxType, index) => {
|
||||
FC.getSerialRxTypes().forEach((serialRxType, index) => {
|
||||
serialRXSelectEl.append(`<option value="${index}">${serialRxType}</option>`);
|
||||
});
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ OSD.generateTemperaturePreview = function(osdData, temperature) {
|
|||
};
|
||||
|
||||
OSD.generateLQPreview = function() {
|
||||
const crsfIndex = FC.RX_CONFIG.getSerialRxTypes().findIndex(name => name === 'CRSF');
|
||||
const crsfIndex = FC.getSerialRxTypes().findIndex(name => name === 'CRSF');
|
||||
const isXF = crsfIndex === FC.RX_CONFIG.serialrx_provider;
|
||||
return FONT.symbol(SYM.LINK_QUALITY) + (isXF ? '2:100' : '8');
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue