mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-19 14:25:14 +03:00
Fix serialportconfig (#3084)
This commit is contained in:
parent
46f0bb3885
commit
6b78f369fd
2 changed files with 33 additions and 8 deletions
|
@ -860,7 +860,9 @@ function reinitializeConnection(callback) {
|
||||||
clearInterval(reconnect);
|
clearInterval(reconnect);
|
||||||
getStatus();
|
getStatus();
|
||||||
GUI.log(i18n.getMessage('deviceReady'));
|
GUI.log(i18n.getMessage('deviceReady'));
|
||||||
callback?.();
|
if (callback === typeof('function')) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
attempts++;
|
attempts++;
|
||||||
if (attempts > 100) {
|
if (attempts > 100) {
|
||||||
|
|
|
@ -432,14 +432,37 @@ ports.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// enable / disable features based on port configuration
|
// enable / disable features based on port configuration
|
||||||
const func = serialPortConfig.functions;
|
let enableRxSerial = false;
|
||||||
const featureConfig = FC.FEATURE_CONFIG.features;
|
let enableTelemetry = false;
|
||||||
|
let enableBlackbox = false;
|
||||||
|
let enableEsc = false;
|
||||||
|
let enableGps = false;
|
||||||
|
|
||||||
const enableRxSerial = func.includes('RX_SERIAL');
|
for (const port of FC.SERIAL_CONFIG.ports) {
|
||||||
const enableTelemetry = func.some(e => e.startsWith("TELEMETRY"));
|
const func = port.functions;
|
||||||
const enableBlackbox = func.includes('BLACKBOX');
|
|
||||||
const enableEsc = func.includes('ESC_SENSOR');
|
if (func.includes('RX_SERIAL')) {
|
||||||
const enableGps = func.includes('GPS');
|
enableRxSerial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (func.some(e => e.startsWith("TELEMETRY"))) {
|
||||||
|
enableTelemetry = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (func.includes('BLACKBOX')) {
|
||||||
|
enableBlackbox = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (func.includes('ESC_SENSOR')) {
|
||||||
|
enableEsc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (func.includes('GPS')) {
|
||||||
|
enableGps = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const featureConfig = FC.FEATURE_CONFIG.features;
|
||||||
|
|
||||||
if (enableRxSerial) {
|
if (enableRxSerial) {
|
||||||
featureConfig.enable('RX_SERIAL');
|
featureConfig.enable('RX_SERIAL');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue