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);
|
||||
getStatus();
|
||||
GUI.log(i18n.getMessage('deviceReady'));
|
||||
callback?.();
|
||||
if (callback === typeof('function')) {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
attempts++;
|
||||
if (attempts > 100) {
|
||||
|
|
|
@ -432,14 +432,37 @@ ports.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// enable / disable features based on port configuration
|
||||
const func = serialPortConfig.functions;
|
||||
const featureConfig = FC.FEATURE_CONFIG.features;
|
||||
let enableRxSerial = false;
|
||||
let enableTelemetry = false;
|
||||
let enableBlackbox = false;
|
||||
let enableEsc = false;
|
||||
let enableGps = false;
|
||||
|
||||
const enableRxSerial = func.includes('RX_SERIAL');
|
||||
const enableTelemetry = func.some(e => e.startsWith("TELEMETRY"));
|
||||
const enableBlackbox = func.includes('BLACKBOX');
|
||||
const enableEsc = func.includes('ESC_SENSOR');
|
||||
const enableGps = func.includes('GPS');
|
||||
for (const port of FC.SERIAL_CONFIG.ports) {
|
||||
const func = port.functions;
|
||||
|
||||
if (func.includes('RX_SERIAL')) {
|
||||
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) {
|
||||
featureConfig.enable('RX_SERIAL');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue