@@ -11,8 +11,7 @@ var SerialPort = require('serialport').SerialPort,
11
11
sp = null ;
12
12
13
13
var SerialPort2 = require ( 'serialport' ) ;
14
-
15
- //function runAVRDude(hexfile, portpath, options, debug, cb) {
14
+
16
15
function runAVRDude ( hexfile , options , debug , cb ) {
17
16
debug ( "running AVR dude" ) ;
18
17
if ( options . platform . useSerial ( ) ) {
@@ -43,17 +42,6 @@ function runAVRDude(hexfile, options, debug, cb) {
43
42
}
44
43
45
44
console . log ( "running" , uploadcmd . join ( ' ' ) ) ;
46
- //---------------------------------
47
- //sp = new SerialPort(portpath,{
48
- // sp = new SerialPort(options.port,{ baudRate:1200 });
49
- // sp = new SerialPort(options.port);
50
-
51
- // sp.on('open',function() {
52
- // sp.close(function(err) {
53
- // if(!err){
54
- //var start = new Date().getTime();
55
- //while(((new Date).getTime()-start)<=2000){};
56
-
57
45
var result = child_process . execFile (
58
46
uploadcmd [ 0 ] ,
59
47
uploadcmd . slice ( 1 ) ,
@@ -77,11 +65,6 @@ function runAVRDude(hexfile, options, debug, cb) {
77
65
}
78
66
}
79
67
) ;
80
- // }
81
- // else
82
- // console.log("APERTURA errore");
83
- // });
84
- // });
85
68
}
86
69
87
70
function scanForPortReturn ( list1 , options , cb ) {
@@ -97,8 +80,7 @@ function scanForPortReturn(list1,options, cb) {
97
80
} , 700 ) ;
98
81
} else {
99
82
console . log ( 'we are back to normal!' ) ;
100
- //TODO controllare
101
- console . log ( "...................................................." )
83
+ //TODO
102
84
setTimeout ( function ( ) {
103
85
console . log ( JSON . stringify ( list2 ) ) ;
104
86
console . log ( "TEST 2: " + options . device . uid . length ) ;
@@ -111,11 +93,9 @@ function scanForPortReturn(list1,options, cb) {
111
93
//if (list2[item].pnpId=="") {
112
94
console . log ( "SELECTED : " + JSON . stringify ( list2 [ item ] ) ) ;
113
95
selected = list2 [ item ] . comName ;
114
- //cb(list2[item].comName);
115
96
}
116
97
}
117
98
}
118
- //cb(list1[list1.length-1].comName);
119
99
cb ( selected ) ;
120
100
} , 500 ) ;
121
101
}
@@ -194,8 +174,6 @@ exports.upload = function(hexfile,options, publish, callback) {
194
174
}
195
175
}
196
176
console . log ( "uploading to device using " , options . device ) ;
197
-
198
- //if(options.device.bootloader.path == 'caterina') {
199
177
if ( options . device . bootloader . file . indexOf ( 'caterina' ) > - 1 ) {
200
178
console . log ( "need to do the leonardo dance" ) ;
201
179
@@ -233,7 +211,7 @@ exports.upload = function(hexfile,options, publish, callback) {
233
211
}
234
212
}
235
213
236
- //TODO modificare port con options.port e lasciare un solo parametro
214
+ //TODO edit port -> options.port ; 1 parameter
237
215
exports . writeBootloader = function ( port , options ) {
238
216
console . log ( "running AVR dude" ) ;
239
217
@@ -254,8 +232,7 @@ exports.writeBootloader = function(port, options){
254
232
255
233
if ( options . verboseupload )
256
234
cmd . push ( '-v' , '-v' , '-v' , '-v' ) ;
257
-
258
- console . log ( "******************************************" ) ;
235
+
259
236
console . log ( "writing bootloader \n" , uploadcmd . join ( ' ' ) ) ;
260
237
261
238
var newcmd = customizeUpload ( uploadcmd , uploadcmd [ searchStringInArray ( '-c' , uploadcmd ) ] . slice ( 2 ) ) ;
0 commit comments