• Apologies, real work took over! but a few weeks away and it was solved in a few seconds grrrrr...

    I tried a few other of the commands that shouldn't require any update to baud rate, and stumbled across what i think was the problem.

    This didn't seem to ever work, no matter what the testNMEACommand;

    serial.setup(9600, { tx: options.tx, rx: options.rx });
    serial.println(testNMEACommand); // attempt to send something to the GPS unit
    

    But this does;

    serial.setup(9600, { tx: options.tx, rx: options.rx });
    setTimeout(function () {
       serial.println(testNMEACommand); //  attempt to send something to the GPS unit
    }, 10);
    

    I guess the connection just hadn't been made, by giving it just a few ms, the commands are being acknowledged (i'm getting PMTKACT sentences back, that at least tells me i'm sending something).

    Is it better in this case to perhaps wait for the GPS unit's first communication to me i.e.

    var connected = false;
    serial.on('data', function () {
        if (!connected){ 
            serial.println(testNMEACommand);
            connected = true;
        }
        ......
    });
    

    As i suppose the timeout of 10ms may sometimes fail? I couldn't see a serial.on('connected') or similar command (as i suppose it's up to the device itself to send a heartbeat back, which can't be relied upon?).

About

Avatar for ct5845 @ct5845 started