duino icon indicating copy to clipboard operation
duino copied to clipboard

'connected' event triggers before the SerialPort is opened

Open fcovas opened this issue 11 years ago • 0 comments

If I run the examples/basic.js the application crashes because the serial port is not opened on the 'connected' event. Shouldn't the 'connected' event only be emitted after the SerialPort 'open' event?

Here https://github.com/ecto/duino/blob/master/lib/board.js#L28, instead of:

self.emit('connected');

do this:

self.serial.on('open', function(){
    self.emit('connected');
});

fcovas avatar May 02 '14 00:05 fcovas