-
Notifications
You must be signed in to change notification settings - Fork 226
Add CLI Burn Bootloader Command #1463
base: main
Are you sure you want to change the base?
Conversation
|
||
if (!dc.port) { | ||
await this._selectSerial(); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding this right, this forces someone to select the port, and then have to restart the burn bootloader process. Is this what you were going after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was using the same flow found in _build()
for this just to be safe. I do like the idea of allowing burn bootloader or build operations continuing if a serial is selected though. It may be worth bringing this up in a separate issue.
|
||
this._state = ArduinoState.BurningBootloader; | ||
try { | ||
return await this._burnBootloader(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is located in a try catch, but the _burnBootloader method seems to primarly use the boolean return value to signal success or failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I mostly followed a similar flow to build()
which handles potentially unhandled exceptions.
Originally the code was like the following:
return await thenable.then((ret) => {
// setState
return ret;
).catch((reason) => {
// setState
// logReason
return false;
});
I figured that a try catch finally approach would do the same task and appear more readable and reduce the repeated lines that set the state. The only difference being that the state is set after the operation returns.
try {
return await thenable;
} catch (reason) {
// logReason
return false;
} finally {
// setState
}
I'm open to suggestions though!
…into burn-bootloader
/azp run |
Description
This PR integrates the
burn-bootloader
command into this extension when usingarduino-cli
. Functionality needs to be added to the Arduino IDE command line before full support for both can be integrated. An issue has been raised upstream to request this feature be added to the Arduino IDE (arduino/Arduino#11765).To Test
arduino-cli
.Arduino CLI: Burn Bootloader
command.Expected Result
Bootloader has been burned to the selected board successfully.
Additional Notes
arduino-cli
since this feature is not yet supported using the IDE command line.arduino-cli
v0.12+ is required to run this command.Partially Fixes #967