Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips to improve stability #3

Open
dotMorten opened this issue Sep 16, 2020 · 2 comments
Open

Tips to improve stability #3

dotMorten opened this issue Sep 16, 2020 · 2 comments

Comments

@dotMorten
Copy link

Found two issues and wanted to share the findings:

  • I know the NMEA spec specifies 82 character max, however when using a high-accuracy GPS which needs a lot more digits to represent the precision, you go beyond the limit. I'd suggest making the buffer size configurable beyond 77. (100 works just fine for me).
  • I was getting A LOT of parsing errors. I couldn't reproduce in a console app, making me suspect the buffer. I found the following approach to run way more stable:

in setup() set timeout pretty low:

Serial.setTimeout(10);

In the loop reach in chunks:

char buf[1024];
int readCount;
void loop()
{
  if (Serial1.available()) {
    while((readCount = Serial.readBytes(buf, 1024)) > 0)
    {
      for(int i=0;i<readCount;i++)
        parser << buf[i];
    }
 }

With these two changes, all my parser errors went away.
You might want to update the doc to suggest the read approach. Might only be an issue on slow arduino's?

@ssozonoff
Copy link

I am also randomly experiencing parse issues so for without any explanation. Seems like the parser in some instances does not "recover" from a failed parse ?? i.e. it will fail systematically on 60+ NMEA sentences. I can power down the system and bring it back up and then it will work.

Thanks for your tips

@ssozonoff
Copy link

ssozonoff commented Jan 12, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants