Merge pull request #101 from basrijn/master

Added support for the GSA sentence
This commit is contained in:
Matt Goodrich 2019-11-04 17:44:35 -05:00 committed by GitHub
commit 83db2e0e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 13 deletions

View File

@ -204,6 +204,63 @@ boolean Adafruit_GPS::parse(char *nmea) {
return true;
}
if (strStartsWith(nmea, "$GPGSA")) {
// found GSA
// parse out Auto selection, but ignore them
p = strchr(p, ',')+1;
// parse out 3d fixquality
p = strchr(p, ',')+1;
if (',' != *p)
{
fixquality_3d = atoi(p);
}
// parse out Satellite PDNs, but ignore them
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
//parse out PDOP
p = strchr(p, ',')+1;
if (',' != *p)
{
PDOP = atof(p);
}
// parse out HDOP, we also parse this from the GGA sentence. Chipset should report the same for both
p = strchr(p, ',')+1;
if (',' != *p)
{
HDOP = atof(p);
}
// parse out VDOP
p = strchr(p, ',')+1;
if (',' != *p)
{
VDOP = atof(p);
}
return true;
}
// we dont parse the remaining, yet!
return false;
}
@ -573,12 +630,12 @@ void Adafruit_GPS::common_init(void) {
lastline = line2;
hour = minute = seconds = year = month = day =
fixquality = satellites = 0; // uint8_t
fixquality = fixquality_3d = satellites = 0; // uint8_t
lat = lon = mag = 0; // char
fix = false; // boolean
milliseconds = 0; // uint16_t
latitude = longitude = geoidheight = altitude =
speed = angle = magvariation = HDOP = 0.0; // float
speed = angle = magvariation = HDOP = VDOP = PDOP = 0.0; // float
}
/**************************************************************************/

View File

@ -66,6 +66,7 @@
#define PMTK_SET_NMEA_OUTPUT_GSAONLY "$PMTK314,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the GPGSA
#define PMTK_SET_NMEA_OUTPUT_GSVONLY "$PMTK314,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on just the GPGSV
#define PMTK_SET_NMEA_OUTPUT_RMCGGA "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on GPRMC and GPGGA
#define PMTK_SET_NMEA_OUTPUT_RMCGGAGSA "$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" ///< turn on GPRMC, GPGGA and GPGSA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_OFF "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" ///< turn off output
@ -159,11 +160,14 @@ class Adafruit_GPS : public Print{
float angle; ///< Course in degrees from true north
float magvariation; ///< Magnetic variation in degrees (vs. true north)
float HDOP; ///< Horizontal Dilution of Precision - relative accuracy of horizontal position
float VDOP; ///< Vertical Dilution of Precision - relative accuracy of vertical position
float PDOP; ///< Position Dilution of Precision - Complex maths derives a simple, single number for each kind of DOP
char lat; ///< N/S
char lon; ///< E/W
char mag; ///< Magnetic variation direction
boolean fix; ///< Have a fix?
uint8_t fixquality; ///< Fix quality (0, 1, 2 = Invalid, GPS, DGPS)
uint8_t fixquality_3d; ///< 3D fix quality (1, 3, 3 = Nofix, 2D fix, 3D fix)
uint8_t satellites; ///< Number of satellites in use
boolean waitForSentence(const char *wait, uint8_t max = MAXWAITSENTENCE, boolean usingInterrupts = false);