mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-22 15:55:33 +03:00
Fix webserial device not found
This commit is contained in:
parent
a571c78db2
commit
c29cffd1d1
1 changed files with 1 additions and 8 deletions
|
@ -44,7 +44,6 @@ class WebSerial extends EventTarget {
|
|||
this.closeRequested = false;
|
||||
this.transmitting = false;
|
||||
this.connectionInfo = null;
|
||||
this.refreshRequired = true;
|
||||
|
||||
this.bitrate = 0;
|
||||
this.bytesSent = 0;
|
||||
|
@ -80,7 +79,6 @@ class WebSerial extends EventTarget {
|
|||
const added = this.createPort(device);
|
||||
this.ports.push(added);
|
||||
this.dispatchEvent(new CustomEvent("addedDevice", { detail: added }));
|
||||
this.refreshRequired = true;
|
||||
return added;
|
||||
}
|
||||
|
||||
|
@ -88,7 +86,6 @@ class WebSerial extends EventTarget {
|
|||
const removed = this.ports.find((port) => port.port === device);
|
||||
this.ports = this.ports.filter((port) => port.port !== device);
|
||||
this.dispatchEvent(new CustomEvent("removedDevice", { detail: removed }));
|
||||
this.refreshRequired = true;
|
||||
}
|
||||
|
||||
handleReceiveBytes(info) {
|
||||
|
@ -123,7 +120,6 @@ class WebSerial extends EventTarget {
|
|||
const ports = await navigator.serial.getPorts();
|
||||
this.portCounter = 1;
|
||||
this.ports = ports.map((port) => this.createPort(port));
|
||||
this.refreshRequired = false;
|
||||
} catch (error) {
|
||||
console.error(`${logHead} Error loading devices:`, error);
|
||||
}
|
||||
|
@ -145,14 +141,11 @@ class WebSerial extends EventTarget {
|
|||
} catch (error) {
|
||||
console.error(`${logHead} User didn't select any SERIAL device when requesting permission:`, error);
|
||||
}
|
||||
this.refreshRequired = true;
|
||||
return newPermissionPort;
|
||||
}
|
||||
|
||||
async getDevices() {
|
||||
if (this.refreshRequired) {
|
||||
await this.loadDevices();
|
||||
}
|
||||
await this.loadDevices();
|
||||
return this.ports;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue