You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Depending on the datarate and what else you do when you get the decoded data it could be that the data can't be processed fast enough and the buffer overflows?

    Maybe check E.getErrorFlags() to see if that's the case? If so it's finding a way to decode the data a bit faster - maybe something like:

    Serial1.on('data', function(data) {
      buf += data;
      var i = buf.indexOf("\x00\xFF");
      while (i>=15) {
        decode(buf.substr(i-15,16));
        buf = buf.substr(i+1); 
        i = buf.indexOf("\x00\xFF");
      }
    });
    

    Not tested, but might work - of course the way I've done it above you're always one frame behind.

    Also... which board are you using? different boards have different serial buffer sizes

About

Avatar for Gordon @Gordon started