@@ -101,10 +101,14 @@ export class ArduinoApp {
101
101
*/
102
102
public async upload ( compile : boolean = true , useProgrammer : boolean = false ) {
103
103
const dc = DeviceContext . getInstance ( ) ;
104
+ const args : string [ ] = [ ] ;
104
105
const boardDescriptor = this . getBoardBuildString ( ) ;
105
106
if ( ! boardDescriptor ) {
106
107
return ;
107
108
}
109
+ if ( ! this . useArduinoCli ( ) ) {
110
+ args . push ( "--board" , boardDescriptor ) ;
111
+ }
108
112
109
113
const selectProgrammer = useProgrammer ? this . getProgrammerString ( ) : null ;
110
114
if ( useProgrammer && ! selectProgrammer ) {
@@ -149,10 +153,17 @@ export class ArduinoApp {
149
153
}
150
154
151
155
const appPath = path . join ( ArduinoWorkspace . rootPath , dc . sketch ) ;
152
- // TODO: add the --clean argument to the cli args when v 0.14 is released (this will clean up the build folder after uploading)
153
- const args = ( ! compile && this . useArduinoCli ( ) ) ? [ "upload" , "-b" , boardDescriptor ] :
154
- this . useArduinoCli ( ) ? [ "compile" , "--upload" , "-b" , boardDescriptor ] :
155
- [ "--upload" , "--board" , boardDescriptor ] ;
156
+ if ( ! this . useArduinoCli ( ) ) {
157
+ args . push ( "--upload" ) ;
158
+ } else {
159
+ // TODO: add the --clean argument to the cli args when v 0.14 is released (this will clean up the build folder after uploading)
160
+ if ( compile ) {
161
+ args . push ( "compile" , "--upload" ) ;
162
+ } else {
163
+ args . push ( "upload" ) ;
164
+ }
165
+ args . push ( "-b" , boardDescriptor ) ;
166
+ }
156
167
157
168
if ( useProgrammer ) {
158
169
if ( this . useArduinoCli ( ) ) {
@@ -206,10 +217,14 @@ export class ArduinoApp {
206
217
207
218
public async verify ( output : string = "" ) {
208
219
const dc = DeviceContext . getInstance ( ) ;
220
+ const args : string [ ] = [ ] ;
209
221
const boardDescriptor = this . getBoardBuildString ( ) ;
210
222
if ( ! boardDescriptor ) {
211
223
return false ;
212
224
}
225
+ if ( ! this . useArduinoCli ( ) ) {
226
+ args . push ( "--board" , boardDescriptor ) ;
227
+ }
213
228
214
229
if ( ! ArduinoWorkspace . rootPath ) {
215
230
vscode . window . showWarningMessage ( "Cannot find the sketch file." ) ;
@@ -229,7 +244,14 @@ export class ArduinoApp {
229
244
}
230
245
231
246
const appPath = path . join ( ArduinoWorkspace . rootPath , dc . sketch ) ;
232
- const args = this . useArduinoCli ( ) ? [ "compile" , "-b" , boardDescriptor , appPath ] : [ "--verify" , "--board" , boardDescriptor , appPath ] ;
247
+
248
+ if ( ! this . useArduinoCli ( ) ) {
249
+ args . push ( "--verify" ) ;
250
+ } else {
251
+ args . push ( "compile" , "-b" , boardDescriptor ) ;
252
+ }
253
+
254
+ args . push ( appPath ) ;
233
255
if ( VscodeSettings . getInstance ( ) . logLevel === "verbose" ) {
234
256
args . push ( "--verbose" ) ;
235
257
}
0 commit comments