Open joshunger opened 5 years ago
Wow... that's weird. It is totally missing. I can't even find a time in github history when it existed and this code is over three years old... but it worked... I've used it.
I'll get back to the postmortem later. In the meantime, I'll get a fix for you ASAP.
I don't have a GPS or other serial device I can test with (or a T2 for that matter). If I send you a tweak for tessel-io/lib/index.js can you try it out for me?
If you're in a hurry, just change this line in node_modules/johnny-five/lib/gps.js
state.portId = opts.serialPort || opts.portId || opts.port || opts.bus || this.io.SERIAL_PORT_IDs.DEFAULT;
to
state.portId = opts.serialPort || opts.portId || opts.port || opts.bus;
and make sure you specify port: "A"
in your GPS opts.
I need to noodle over wether this should be fixed in Johnny-Five or tessel-io.
Excellent, thanks for the help @dtex !
@dtex are there any big benefits of using GPS
vs. just consuming the Tessel UART
stream directly?
There is no black magic in the J5 GPS code. Configuration is a little easier and having the GPS be an event emitter is helpful. Also, you don't have to worry about parsing the NMEA sentences yourself.
I got the exact same issue. Your quick fix solved it but now I'm getting this error here:
>> events.js:239
throw new TypeError('"listener" argument must be a function');
^
TypeError: "listener" argument must be a function
at _addListener (events.js:239:11)
at UART.addListener (events.js:297:10)
at UART.Readable.on (_stream_readable.js:772:35)
at P.serialRead (/tmp/remote-script/node_modules/tessel-io/lib/index.js:1:8634)
at e.listen (/tmp/remote-script/node_modules/johnny-five/lib/gps.js:1:2975)
at e.<anonymous> (/tmp/remote-script/node_modules/johnny-five/lib/gps.js:1:2640)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
@dtex Do you have any idea? My code is super basic:
"use strict";
const five = require("johnny-five");
const Tessel = require("tessel-io");
const board = new five.Board({
io: new Tessel()
});
board.on("ready", () => {
var gps = new five.GPS({
port: 'A',
pins: {rx: 6, tx: 5}
});
// If latitude, longitude change log it
gps.on("change", function() {
console.log("position");
console.log(" latitude : ", this.latitude);
console.log(" longitude : ", this.longitude);
console.log(" altitude : ", this.altitude);
console.log("--------------------------------------");
});
// If speed, course change log it
gps.on("navigation", function() {
console.log("navigation");
console.log(" speed : ", this.speed);
console.log(" course : ", this.course);
console.log("--------------------------------------");
});
});
io.SERIAL_PORT_IDs
is returning undefined for me. Is this supposed to be implemented?