Skip to content

Commit ec50ea6

Browse files
Akos Kittajbicker
Akos Kitta
authored andcommitted
do not await for attached boards.
Signed-off-by: Akos Kitta <[email protected]>
1 parent 502e904 commit ec50ea6

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

arduino-ide-extension/src/browser/boards/boards-config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class BoardsConfig extends React.Component<BoardsConfig.Props, BoardsConf
105105
this.queryPorts(Promise.resolve({ boards })).then(({ knownPorts }) => {
106106
let { selectedPort } = this.state;
107107
const removedPorts = detachedBoards.filter(AttachedSerialBoard.is).map(({ port }) => port);
108-
if (!!selectedPort && removedPorts.indexOf(selectedPort) === -1) {
108+
if (!!selectedPort && removedPorts.indexOf(selectedPort) !== -1) {
109109
selectedPort = undefined;
110110
}
111111
this.setState({ knownPorts, selectedPort }, () => this.fireConfigChanged());

arduino-ide-extension/src/browser/boards/boards-service-client-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class BoardsServiceClientImpl implements BoardsServiceClient {
3434
const { selectedPort, selectedBoard } = this.boardsConfig;
3535
this.onAttachedBoardsChangedEmitter.fire(event);
3636
// Dynamically unset the port if the selected board was an attached one and we detached it.
37-
if (!!selectedPort && detachedBoards.indexOf(selectedPort) === -1) {
37+
if (!!selectedPort && detachedBoards.indexOf(selectedPort) !== -1) {
3838
this.boardsConfig = {
3939
selectedBoard,
4040
selectedPort: undefined

arduino-ide-extension/src/node/boards-service-impl.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { PlatformSearchReq, PlatformSearchResp, PlatformInstallReq, PlatformInst
66
import { CoreClientProvider } from './core-client-provider';
77
import { BoardListReq, BoardListResp } from './cli-protocol/commands/board_pb';
88
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
9-
import { Deferred } from '@theia/core/lib/common/promise-util';
109

1110
@injectable()
1211
export class BoardsServiceImpl implements BoardsService {
@@ -23,7 +22,6 @@ export class BoardsServiceImpl implements BoardsService {
2322

2423
protected selectedBoard: Board | undefined;
2524
protected discoveryInitialized = false;
26-
protected discoveryReady = new Deferred<void>();
2725
protected discoveryTimer: NodeJS.Timeout | undefined;
2826
/**
2927
* Poor man's serial discovery:
@@ -41,7 +39,6 @@ export class BoardsServiceImpl implements BoardsService {
4139
this.doGetAttachedBoards().then(({ boards }) => {
4240
const update = (oldState: Board[], newState: Board[], message: string) => {
4341
this._attachedBoards = { boards: newState };
44-
this.discoveryReady.resolve();
4542
this.discoveryLogger.info(`${message} - Discovered boards: ${JSON.stringify(newState)}`);
4643
if (this.client) {
4744
this.client.notifyAttachedBoardsChanged({
@@ -91,7 +88,6 @@ export class BoardsServiceImpl implements BoardsService {
9188
}
9289

9390
async getAttachedBoards(): Promise<{ boards: Board[] }> {
94-
await this.discoveryReady.promise;
9591
return this._attachedBoards;
9692
}
9793

0 commit comments

Comments
 (0)