Skip to content

Commit b8bf1ee

Browse files
committed
Allow uploads without port selection
It is common for a "port" to be used in some way during the process of uploading to a board. However, the array of Arduino boards is very diverse. Some of these do not produce a port and their upload method has no need for one. For this reason, the IDE must allow the upload process to be initiated regardless of whether a port happens to be selected. During the addition of support for user provided fields, an unwarranted assumption was made that all boards require a port selection for upload and this resulted in a regression that broke uploading for these boards. This regression was especially user unfriendly in that there was no response whatsoever from the IDE when the user attempted to initiate an upload under these conditions. The bug is hereby fixed. The upload process will always be initiated by the IDE regardless of whether a port is selected. In cases where a port is required, the resulting error message returned by Arduino CLI or the upload tool will communicate the problem to the user.
1 parent 93291b6 commit b8bf1ee

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: arduino-ide-extension/src/browser/boards/boards-service-provider.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,16 @@ export class BoardsServiceProvider
409409
}
410410

411411
async selectedBoardUserFields(): Promise<BoardUserField[]> {
412-
if (!this._boardsConfig.selectedBoard || !this._boardsConfig.selectedPort) {
412+
if (!this._boardsConfig.selectedBoard) {
413413
return [];
414414
}
415415
const fqbn = this._boardsConfig.selectedBoard.fqbn;
416416
if (!fqbn) {
417417
return [];
418418
}
419-
const protocol = this._boardsConfig.selectedPort.protocol;
419+
// Protocol must be set to `default` when uploading without a port selected:
420+
// https://arduino.github.io/arduino-cli/dev/platform-specification/#sketch-upload-configuration
421+
const protocol = this._boardsConfig.selectedPort?.protocol || 'default';
420422
return await this.boardsService.getBoardUserFields({ fqbn, protocol });
421423
}
422424

Diff for: arduino-ide-extension/src/browser/contributions/user-fields.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ export class UserFields extends Contribution {
6666
}
6767
const address =
6868
boardsConfig.selectedBoard?.port?.address ||
69-
boardsConfig.selectedPort?.address;
70-
if (!address) {
71-
return undefined;
72-
}
69+
boardsConfig.selectedPort?.address ||
70+
'';
7371
return fqbn + '|' + address;
7472
}
7573

0 commit comments

Comments
 (0)