mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-16 07:46:32 +00:00
fine tuned selectedPort
update
based on the detached boards. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
66f429c478
commit
502e9042ad
@ -30,11 +30,11 @@ export class BoardsServiceClientImpl implements BoardsServiceClient {
|
|||||||
|
|
||||||
notifyAttachedBoardsChanged(event: AttachedBoardsChangeEvent): void {
|
notifyAttachedBoardsChanged(event: AttachedBoardsChangeEvent): void {
|
||||||
this.logger.info('Attached boards changed: ', JSON.stringify(event));
|
this.logger.info('Attached boards changed: ', JSON.stringify(event));
|
||||||
const { boards } = event.newState;
|
const detachedBoards = AttachedBoardsChangeEvent.diff(event).detached.filter(AttachedSerialBoard.is).map(({ port }) => port);
|
||||||
const { selectedPort, selectedBoard } = this.boardsConfig;
|
const { selectedPort, selectedBoard } = this.boardsConfig;
|
||||||
this.onAttachedBoardsChangedEmitter.fire(event);
|
this.onAttachedBoardsChangedEmitter.fire(event);
|
||||||
// Dynamically unset the port if there is not corresponding attached boards for it.
|
// Dynamically unset the port if the selected board was an attached one and we detached it.
|
||||||
if (!!selectedPort && boards.filter(AttachedSerialBoard.is).map(({ port }) => port).indexOf(selectedPort) === -1) {
|
if (!!selectedPort && detachedBoards.indexOf(selectedPort) === -1) {
|
||||||
this.boardsConfig = {
|
this.boardsConfig = {
|
||||||
selectedBoard,
|
selectedBoard,
|
||||||
selectedPort: undefined
|
selectedPort: undefined
|
||||||
|
Loading…
x
Reference in New Issue
Block a user