mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-21 15:25:22 +03:00
Merge pull request #2392 from haslinghuis/fix-2389
Check for legacy devices
This commit is contained in:
commit
e7c30f3b4d
1 changed files with 8 additions and 6 deletions
|
@ -242,15 +242,17 @@ PortHandler.selectPort = function(ports) {
|
||||||
for (let i = 0; i < ports.length; i++) {
|
for (let i = 0; i < ports.length; i++) {
|
||||||
const portName = ports[i].displayName;
|
const portName = ports[i].displayName;
|
||||||
if (portName) {
|
if (portName) {
|
||||||
if (portName.includes('STM') || portName.includes('CP210')) {
|
|
||||||
const pathSelect = ports[i].path;
|
const pathSelect = ports[i].path;
|
||||||
if (OS === 'Windows' || (OS !== 'Windows' && pathSelect.includes('tty'))) {
|
const isWindows = (OS === 'Windows');
|
||||||
|
const isTty = pathSelect.includes('tty');
|
||||||
|
const deviceRecognized = portName.includes('STM') || portName.includes('CP210');
|
||||||
|
const legacyDeviceRecognized = portName.includes('usb');
|
||||||
|
if (isWindows && deviceRecognized || isTty && (deviceRecognized || legacyDeviceRecognized)) {
|
||||||
this.portPickerElement.val(pathSelect);
|
this.portPickerElement.val(pathSelect);
|
||||||
console.log(`Porthandler detected device ${portName} on port: ${pathSelect}`);
|
console.log(`Porthandler detected device ${portName} on port: ${pathSelect}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PortHandler.port_detected = function(name, code, timeout, ignore_timeout) {
|
PortHandler.port_detected = function(name, code, timeout, ignore_timeout) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue