Closed arrbs closed 6 years ago
First, make sure that LAST_SENTENCE is set to GLL in NMEAGPS_cfg.h.
Then you can feed the entire array to NeoGPS:
char *ptr = &buffer[0];
while (*ptr)
gps.handle( *ptr++ );
if (gps.available()) {
fix = gps.read();
...
This assumes the buffer is NUL-terminated like a C string (NOT the String class). If you have a count instead, use a for loop.
for (size_t i=0; i<count; i++)
gps.handle( buffer[i] );
NeoGPS will ignore everything but the NMEA sentences. They all start with a $ character.
BTW, you don't really have to buffer all of this... you could feed the response characters to NeoGPS as they arrive. Just test for a fix becoming available:
void loop()
{
if (timeToGetFix()) {
M20.println( F( "AT+QGNSSRD?\n\r") );
}
....
if (M20.available()) {
char c = M20.read();
// Handle command responses
... watch for \r\nOK\r\n ? ...
// Handle GPS data
gps.handle( c );
if (gps.available()) {
fix = gps.read();
...
}
}
Thank you so much!
I really appreciate your help.
Keep up the good work!
Hi there,
Firstly I apologize for asking this question using this medium. I'm busy with a project using a Seeed Wio Tracker. The unit has a Quectel M20 GPS/GPRS module which talks to the Atmel microprocessor via Serial1.
I have to query the module via the AT Command "AT+QGNSSRD?\n\r", which will then once (and only once, until the AT command is called again), respond with the following on Serial1.
I have managed to read this whole statement (including the AT echo and the OK), into a char array buffer.
It would mean a lot to me if someone could please point me in the right direction as to how one would get this data into NeoGPS?
Thank you so much