fix #1383: missing port labels (#1412)

* fallback to port.address if addressLabel is false

* addressLabel if possible, reconcileAvailableBoards

* remove fallback
This commit is contained in:
Dave Simpson 2022-09-15 15:29:28 +02:00 committed by GitHub
parent fdf6f0f9c8
commit 026e80e7fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -600,6 +600,7 @@ export class BoardsServiceProvider
boardsConfig.selectedBoard && boardsConfig.selectedBoard &&
availableBoards.every(({ selected }) => !selected) availableBoards.every(({ selected }) => !selected)
) { ) {
let port = boardsConfig.selectedPort
// If the selected board has the same port of an unknown board // If the selected board has the same port of an unknown board
// that is already in availableBoards we might get a duplicate port. // that is already in availableBoards we might get a duplicate port.
// So we remove the one already in the array and add the selected one. // So we remove the one already in the array and add the selected one.
@ -607,11 +608,15 @@ export class BoardsServiceProvider
(board) => board.port?.address === boardsConfig.selectedPort?.address (board) => board.port?.address === boardsConfig.selectedPort?.address
); );
if (found >= 0) { if (found >= 0) {
// get the "Unknown board port" that we will substitute,
// then we can include it in the "availableBoard object"
// pushed below; to ensure addressLabel is included
port = availableBoards[found].port
availableBoards.splice(found, 1); availableBoards.splice(found, 1);
} }
availableBoards.push({ availableBoards.push({
...boardsConfig.selectedBoard, ...boardsConfig.selectedBoard,
port: boardsConfig.selectedPort, port,
selected: true, selected: true,
state: AvailableBoard.State.incomplete, state: AvailableBoard.State.incomplete,
}); });