Skip to content

Commit

Permalink
Fixed: did not scan for serial ports when port specified
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaclub committed Nov 14, 2015
1 parent 44bea1b commit 6586390
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions index.js
Expand Up @@ -224,15 +224,17 @@ function main() {
if (args.ports.length > 0) {
//closure for stepping through each port
//and connect + upload (use timout callback [iterate] for proceeding)
(function (ports, connect) {
this.ports = ports;
this.idx = 0;
this.connect = connect;
this.iterate = function() {
(idx>=ports.length?process.exit(0):connect(ports[idx++],iterate));
}
iterate();
})(args.ports, connect);
Espruino.Core.Serial.getPorts(function(ports) {
(function (ports, connect) {
this.ports = ports;
this.idx = 0;
this.connect = connect;
this.iterate = function() {
(idx>=ports.length?process.exit(0):connect(ports[idx++],iterate));
}
iterate();
})(args.ports, connect);
});
} else {
log("Searching for serial ports...");
Espruino.Core.Serial.getPorts(function(ports) {
Expand Down

0 comments on commit 6586390

Please sign in to comment.