mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Add websocket support and fix port override (#4187)
* Add websocket support * remove waitforconnection
This commit is contained in:
parent
6908b7efb8
commit
36ccc26acc
5 changed files with 182 additions and 17 deletions
|
@ -107,7 +107,6 @@ function connectDisconnect() {
|
|||
GUI.configuration_loaded = false;
|
||||
|
||||
const baudRate = PortHandler.portPicker.selectedBauds;
|
||||
const selectedPort = portName;
|
||||
|
||||
if (!isConnected) {
|
||||
// prevent connection when we do not have permission
|
||||
|
@ -124,6 +123,7 @@ function connectDisconnect() {
|
|||
|
||||
CONFIGURATOR.virtualMode = selectedPort === 'virtual';
|
||||
CONFIGURATOR.bluetoothMode = selectedPort.startsWith('bluetooth');
|
||||
CONFIGURATOR.manualMode = selectedPort === 'manual';
|
||||
|
||||
if (CONFIGURATOR.virtualMode) {
|
||||
CONFIGURATOR.virtualApiVersion = PortHandler.portPicker.virtualMspVersion;
|
||||
|
@ -131,6 +131,16 @@ function connectDisconnect() {
|
|||
// Hack to get virtual working on the web
|
||||
serial = serialShim();
|
||||
serial.connect(onOpenVirtual);
|
||||
} else if (selectedPort === 'manual') {
|
||||
serial = serialShim();
|
||||
// Explicitly disconnect the event listeners before attaching the new ones.
|
||||
serial.removeEventListener('connect', connectHandler);
|
||||
serial.addEventListener('connect', connectHandler);
|
||||
|
||||
serial.removeEventListener('disconnect', disconnectHandler);
|
||||
serial.addEventListener('disconnect', disconnectHandler);
|
||||
|
||||
serial.connect(portName, { baudRate });
|
||||
} else {
|
||||
CONFIGURATOR.virtualMode = false;
|
||||
serial = serialShim();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue