Skip to content

Commit

Permalink
Do not require SERIAL_PORT_IDs.Default
Browse files Browse the repository at this point in the history
  • Loading branch information
dtex authored and rwaldron committed Apr 5, 2019
1 parent 5d0dc72 commit c8d4f07
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/gps.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ function GPS(opts) {
this, opts = Board.Options(opts)
);



// Get user values for breakout, receiver and chip
breakout = opts.breakout || {};
receiver = opts.receiver;
Expand Down Expand Up @@ -265,7 +263,13 @@ util.inherits(GPS, events.EventEmitter);
GPS.prototype.initialize = function(opts) {

var state = priv.get(this);
state.portId = opts.serialPort || opts.portId || opts.port || opts.bus || this.io.SERIAL_PORT_IDs.DEFAULT;
state.portId = opts.serialPort || opts.portId || opts.port || opts.bus;

// firmata.js has a SERIAL_PORT_IDs.DEFAULT that is not
// necessary in other IO plugins so it won't always exist.
if (typeof state.portId === "undefined" && this.io.SERIAL_PORT_IDs) {
state.portId = this.io.SERIAL_PORT_IDs.DEFAULT;
}

// Set the pin modes
["tx", "rx"].forEach(function(pin) {
Expand Down

0 comments on commit c8d4f07

Please sign in to comment.