Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit 45aa5db

Browse files
committed
add support for cli
1 parent cb3b978 commit 45aa5db

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/arduino/arduino.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ export class ArduinoApp {
516516
}
517517
const boardDescriptor = this.boardManager.currentBoard.getBuildConfig();
518518

519+
if (mode === BuildMode.Analyze) {
520+
args.push("compile");
521+
}
519522
this._settings.useArduinoCli ? args.push("-b", boardDescriptor) : args.push("--board", boardDescriptor);
520523

521524
if (!ArduinoWorkspace.rootPath) {
@@ -626,9 +629,8 @@ export class ArduinoApp {
626629
}
627630

628631
// We always build verbosely but filter the output based on the settings
629-
if (!this._settings.useArduinoCli) {
630-
args.push("--verbose-build");
631-
}
632+
633+
this._settings.useArduinoCli ? args.push("--verbose") : args.push("--verbose-build");
632634

633635
if (verbose) {
634636
this._settings.useArduinoCli ? args.push ("--verbose") : args.push("--verbose-upload");
@@ -675,13 +677,16 @@ export class ArduinoApp {
675677
// TODO EW: What should we do with pre-/post build commands when running
676678
// analysis? Some could use it to generate/manipulate code which could
677679
// be a prerequisite for a successful build
678-
if (!await this.runPrePostBuildCommand(dc, env, "pre")) {
680+
if (dc.prebuild && !await this.runPrePostBuildCommand(dc, env, "pre")) {
679681
return false;
680682
}
681683

682684
// stop serial monitor when everything is prepared and good
683685
// what makes restoring of its previous state easier
684-
if (mode === BuildMode.Upload || mode === BuildMode.UploadProgrammer) {
686+
if (mode === BuildMode.Upload ||
687+
mode === BuildMode.UploadProgrammer ||
688+
mode === BuildMode.CliUpload ||
689+
mode === BuildMode.CliUploadProgrammer) {
685690
restoreSerialMonitor = await SerialMonitor.getInstance().closeSerialMonitor(dc.port);
686691
UsbDetector.getInstance().pauseListening();
687692
}
@@ -744,7 +749,7 @@ export class ArduinoApp {
744749
this._settings.commandPath,
745750
args,
746751
undefined,
747-
{ stdout: stdoutcb, stderr: stderrcb },
752+
{ channel: arduinoChannel.channel, stdout: stdoutcb, stderr: stderrcb },
748753
).then(async () => {
749754
const ret = await cleanup("ok");
750755
if (ret) {

src/arduino/programmerManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class ProgrammerManager {
3535
this._programmerStatusBar.tooltip = "Select Programmer";
3636
this.setProgrammerValue(DeviceContext.getInstance().programmer);
3737
this._programmerStatusBar.show();
38-
DeviceContext.getInstance().onDidChange(() => {
38+
DeviceContext.getInstance().onChangeProgrammer(() => {
3939
this.setProgrammerValue(DeviceContext.getInstance().programmer);
4040
});
4141
}

0 commit comments

Comments
 (0)