Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-grace committed Aug 5, 2024
1 parent e6fe478 commit b34e0e0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/usb-radio-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export class MicrobitRadioBridgeConnection
}

async connect(): Promise<ConnectionStatus> {
this.ignoreDelegateStatus = false;
if (this.disconnectPromise) {
await this.disconnectPromise;
}
Expand All @@ -128,7 +127,7 @@ export class MicrobitRadioBridgeConnection
type: "Connect",
message: "Serial connect start",
});

this.ignoreDelegateStatus = false;
await this.delegate.connect();

try {
Expand Down Expand Up @@ -189,10 +188,9 @@ export class MicrobitRadioBridgeConnection
if (this.disconnectPromise) {
return this.disconnectPromise;
}
this.serialSessionOpen = false;
this.disconnectPromise = (async () => {
this.serialSessionOpen = false;
await this.serialSession?.dispose(true);
this.ignoreDelegateStatus = true;
this.disconnectPromise = undefined;
})();
}
Expand Down

0 comments on commit b34e0e0

Please sign in to comment.