read gps data
Fork of NEO-6m-GPS by
Diff: GPS.cpp
- Revision:
- 3:e37fc1ccd812
- Parent:
- 2:7350eda5fa8c
- Child:
- 4:fa5fed5771c0
diff -r 7350eda5fa8c -r e37fc1ccd812 GPS.cpp --- a/GPS.cpp Fri Aug 12 08:14:08 2016 +0000 +++ b/GPS.cpp Tue Mar 20 12:46:57 2018 +0000 @@ -32,10 +32,11 @@ int GPS::sample() { - + int lock; while(1) { + getline(); // Check if it is a GPGGA msg (matches both locked and non-locked msg) @@ -81,11 +82,13 @@ void GPS::getline() { - while(_gps.getc() != '$'); // wait for the start of a line + while(_gps.getc() != '$'); + // wait for the start of a line for(int i=0; i<256; i++) { msg[i] = _gps.getc(); if(msg[i] == '\r') { msg[i] = 0; + return; } }