Git Product home page Git Product logo

nmeaparser's People

Contributors

glinnes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nmeaparser's Issues

ERROR : 1

i, a implement the library in my project that read NMEA sentence from WiFI, This is code:
....
while (client.available()) {
String Sentence = client.readStringUntil('\r');
int len = Sentence.length() + 1;
char WindSentence[len];
Sentence.toCharArray(WindSentence, len);
for (uint8_t i = 0; i <= strlen(WindSentence); i++) {
parser << WindSentence[i];
}
}
........

And i recive only error.
the sentence in question is : $WIMWV,243.7,T,64.8,N,A*1D
but this is the response:

  • Error : 1
    *** Error : 1
    *** Error : 1
    *** Error : 1

$WIMWV,243.7,T,64.8,N,A*1D
*** Error : 1

$WIMWD,243.7,T,243.7,M,64.8,N,33.3,M*53
*** Error : 1

$WIMWV,271.0,R,64.0,N,A*15
*** Error : 1

$IIMTW,5.4,C*22
*** Error : 1

$SDDPT,59.6,01*42
*** Error : 1

Have you any idea?

Thank's
Stefano

*** Error : 1

Hi,
I continuously receive :
*** Error : 1 sequences, and sometimes *** Error : 3.
It only parsed once a sentence in all the tests is did.
Why?
Could be due to the rate of com?
Regards.

PS I checked also the led example and gives the same error.

Connections:


Instrument sending NMEA sentences on Serial3. PC on Serial.

Type of sentences:


$PSONCMS,-0.9888,0.0072,-0.0056,-0.1491,-0.1582,-0.1052,9.8084,0.0001,-0.0016,-0.0004,0.2222,-0.1642,-1.1150,31.9*71

$GPGGA,003906.33,0000.0000,S,00000.0000,W,0,00,100.0,-17.0,M,0.0,M,,*44

$XSVEL,+000.0000,+000.0000,+000.0000*4D

CODE:


// LIBRARIES
#include <NMEAParser.h>

//INITIALISE LIBRARIES
NMEAParser<3> NMEAin; //Number of NMEA Parsers Handlers & NAME of the Parser

//INITIALISE VARIABLES
float GPS_Vx;
float GPS_Vy;
float GPS_Vz;

int incomingByte = 0; // for incoming Serial Data Bytes
char incomingChar; // for Bytes to String Data
//char incomingStr[50];

/* SETUP NMEA PARSER /
void errorHandler()
{
Serial.print("
** Error : ");
Serial.println(NMEAin.error());
}

void unknownCommand()
{
Serial.print("*** Unkown command : ");
char buf[20];
NMEAin.getType(buf);
Serial.println(buf);
}

//SENTENCES HANDLERS

void PSONCMS_Handler()
{
Serial.print("Got PSONCMS with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
}

void GPGGA_Handler()
{
Serial.print("Got GPGGA with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
}

void XSVEL_Handler()
{
Serial.print("Got XSVEL with ");
Serial.print(NMEAin.argCount());
Serial.println(" arguments");
float GPS_Vx;
if (NMEAin.getArg(0,GPS_Vx)) Serial.println(GPS_Vx);
//if (NMEAin.getArg(1,GPS_Vy)) Serial.println(GPS_Vy);
//if (NMEAin.getArg(2,GPS_Vz)) Serial.println(GPS_Vz);
}
/* ----------------- */

void setup() {
// Turn on serial monitor and set baud rate
Serial3.begin(115200); // GNSS-IMU [Serial3]
Serial.begin(115200); // PC [Serial0] | MAIN-ARDUINO [Serial1]
Serial.write("COM On");

NMEAin.setErrorHandler(errorHandler);
NMEAin.addHandler("PSON-", PSONCMS_Handler);
NMEAin.addHandler("GPGGA", GPGGA_Handler);
NMEAin.addHandler("XSVEL", XSVEL_Handler);
//NMEAin.setDefaultHandler(unknownCommand);
}

void loop() {

while (Serial3.available()) {

  String incomingStr = Serial3.readStringUntil('\n');//READ UNTIL NEW LINE
  Serial.println(incomingStr);                       //PRINT

    for (uint8_t i = 0; i < (incomingStr.length()); i++) {
      NMEAin << incomingStr[i];
   }
  
  //NMEAin << Serial3.read();                        //FORWARD INCOMING CHAR TO PARSER DIRECTLY (Alternative still not working)

}
}

Tips to improve stability

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?

How to Serial.Print full received nmea message

Hi,

is there a function to print a full nmea message received after using:
if (Serial.available()) {
nmea_parse();
}
The ideia is to do a data out to the next device on the network.

Kind regards,

Returning large number of Error 1 responses

Very neat library! I was able to pull depth and temperature data from my transducer and Arduino MEGA but I'm finding that there are many different error outputs for the temperature string. How can I debug or check the full string being sent for the temperature sentence? How does the library determine that a character is out of place?

Handle NMEA statements starting with '!'

Some NMEA statements begin with '!' character. ie: !AIVDM, !AIVDO, etc.

I think this is very easy to implement. Just modify line 402 in NMEAParser.h from if (inChar == '$') { to if (inChar == '$' || inChar == '!') {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.