1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 17:25:16 +03:00

Fix noselection and not closing dfu after flashing (#3993)

* Fix noselection

* Move select#baud element to vue

* Keep focus

* Do not automatically connect after flashing

* Proper select DFU

* Proper select DFU v2

* Proper select DFU v3

* Fix parentheses

* Duh

* Finally

* Cleanup
This commit is contained in:
Mark Haslinghuis 2024-06-03 12:47:24 +02:00 committed by GitHub
parent 3980cdc307
commit 2f87ab29f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 9 deletions

View file

@ -67,7 +67,7 @@
</span>
</div>
<div
v-if="value.selectedPort !== 'virtual'"
v-if="value.selectedPort !== 'virtual' && value.selectedPort !== 'noselection'"
id="baudselect"
>
<div class="dropdown dropdown-dark">

View file

@ -202,10 +202,13 @@ class WEBUSBDFU_protocol extends EventTarget {
this.usbDevice
.releaseInterface(interfaceNumber, () => {
console.log(`Released interface: ${interfaceNumber}`);
this.closeDevice();
})
.catch(error => {
console.log(`Could not release interface: ${interfaceNumber} (${error})`);
})
.finally(() => {
// releaseInterface does not work on some devices, so we close the device anyways
this.closeDevice();
});
}
resetDevice(callback) {

View file

@ -57,7 +57,7 @@ export function initializeSerialBackend() {
$("div.connect_controls a.connect").on('click', connectDisconnect);
EventBus.$on('port-handler:auto-select-serial-device', function(device) {
if (!GUI.connected_to && !GUI.connecting_to
if (!GUI.connected_to && !GUI.connecting_to && GUI.active_tab !== 'firmware_flasher'
&& ((PortHandler.portPicker.autoConnect && !["manual", "virtual"].includes(device))
|| Date.now() - rebootTimestamp < REBOOT_CONNECT_MAX_TIME_MS)) {
connectDisconnect();
@ -95,7 +95,7 @@ function connectDisconnect() {
portName = selectedPort;
}
if (!GUI.connect_lock && selectedPort !== 'none') {
if (!GUI.connect_lock && selectedPort !== 'noselection' && !selectedPort.path?.startsWith('usb_')) {
// GUI control overrides the user control
GUI.configuration_loaded = false;
@ -103,11 +103,6 @@ function connectDisconnect() {
const selected_baud = PortHandler.portPicker.selectedBauds;
const selectedPort = portName;
if (selectedPort === 'DFU') {
$('select#baud').hide();
return;
}
if (!isConnected) {
console.log(`Connecting to: ${portName}`);
GUI.connecting_to = portName;