Merge branch 'koehn-master'
This commit is contained in:
commit
91295fa8e2
|
|
@ -9,7 +9,7 @@ Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
BSD license, check license.txt for more information
|
BSD license, check license.txt for more information
|
||||||
All text above must be included in any redistribution
|
All text above must be included in any redistribution
|
||||||
****************************************/
|
****************************************/
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
#include <Adafruit_GPS.h>
|
#include <Adafruit_GPS.h>
|
||||||
|
|
||||||
// how long are max NMEA lines to parse?
|
// how long are max NMEA lines to parse?
|
||||||
|
|
@ -44,7 +44,7 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
//return false;
|
//return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
char degreebuff[10];
|
||||||
// look for a few common sentences
|
// look for a few common sentences
|
||||||
if (strstr(nmea, "$GPGGA")) {
|
if (strstr(nmea, "$GPGGA")) {
|
||||||
// found GGA
|
// found GGA
|
||||||
|
|
@ -61,7 +61,17 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
|
|
||||||
// parse out latitude
|
// parse out latitude
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
latitude = atof(p);
|
strncpy(degreebuff, p, 2);
|
||||||
|
p += 2;
|
||||||
|
degreebuff[2] = '\0';
|
||||||
|
int32_t degree = atol(degreebuff) * 10000000;
|
||||||
|
strncpy(degreebuff, p, 2); // minutes
|
||||||
|
p += 3; // skip decimal point
|
||||||
|
strncpy(degreebuff + 2, p, 4);
|
||||||
|
degreebuff[6] = '\0';
|
||||||
|
long minutes = 50 * atol(degreebuff) / 3;
|
||||||
|
latitude_fixed = degree + minutes;
|
||||||
|
latitude = latitude_fixed / 100000.0F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'N') lat = 'N';
|
if (p[0] == 'N') lat = 'N';
|
||||||
|
|
@ -71,7 +81,17 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
|
|
||||||
// parse out longitude
|
// parse out longitude
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
longitude = atof(p);
|
strncpy(degreebuff, p, 3);
|
||||||
|
p += 3;
|
||||||
|
degreebuff[3] = '\0';
|
||||||
|
degree = atol(degreebuff) * 10000000;
|
||||||
|
strncpy(degreebuff, p, 2); // minutes
|
||||||
|
p += 3; // skip decimal point
|
||||||
|
strncpy(degreebuff + 2, p, 4);
|
||||||
|
degreebuff[6] = '\0';
|
||||||
|
minutes = 50 * atol(degreebuff) / 3;
|
||||||
|
longitude_fixed = degree + minutes;
|
||||||
|
longitude = longitude_fixed / 100000.0F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'W') lon = 'W';
|
if (p[0] == 'W') lon = 'W';
|
||||||
|
|
@ -120,7 +140,17 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
|
|
||||||
// parse out latitude
|
// parse out latitude
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
latitude = atof(p);
|
strncpy(degreebuff, p, 2);
|
||||||
|
p += 2;
|
||||||
|
degreebuff[2] = '\0';
|
||||||
|
long degree = atol(degreebuff) * 10000000;
|
||||||
|
strncpy(degreebuff, p, 2); // minutes
|
||||||
|
p += 3; // skip decimal point
|
||||||
|
strncpy(degreebuff + 2, p, 4);
|
||||||
|
degreebuff[6] = '\0';
|
||||||
|
long minutes = 50 * atol(degreebuff) / 3;
|
||||||
|
latitude_fixed = degree + minutes;
|
||||||
|
latitude = latitude_fixed / 100000.0F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'N') lat = 'N';
|
if (p[0] == 'N') lat = 'N';
|
||||||
|
|
@ -130,7 +160,17 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
|
|
||||||
// parse out longitude
|
// parse out longitude
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
longitude = atof(p);
|
strncpy(degreebuff, p, 3);
|
||||||
|
p += 3;
|
||||||
|
degreebuff[3] = '\0';
|
||||||
|
degree = atol(degreebuff) * 10000000;
|
||||||
|
strncpy(degreebuff, p, 2); // minutes
|
||||||
|
p += 3; // skip decimal point
|
||||||
|
strncpy(degreebuff + 2, p, 4);
|
||||||
|
degreebuff[6] = '\0';
|
||||||
|
minutes = 50 * atol(degreebuff) / 3;
|
||||||
|
longitude_fixed = degree + minutes;
|
||||||
|
longitude = longitude_fixed / 100000.0F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'W') lon = 'W';
|
if (p[0] == 'W') lon = 'W';
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ All text above must be included in any redistribution
|
||||||
#define LOCUS_OVERLAP 0
|
#define LOCUS_OVERLAP 0
|
||||||
#define LOCUS_FULLSTOP 1
|
#define LOCUS_FULLSTOP 1
|
||||||
|
|
||||||
|
#define PMTK_ENABLE_SBAS "$PMTK313,1*2E"
|
||||||
|
#define PMTK_ENABLE_WAAS "$PMTK301,2*2E"
|
||||||
|
|
||||||
// standby command & boot successful message
|
// standby command & boot successful message
|
||||||
#define PMTK_STANDBY "$PMTK161,0*28"
|
#define PMTK_STANDBY "$PMTK161,0*28"
|
||||||
#define PMTK_STANDBY_SUCCESS "$PMTK001,161,3*36" // Not needed currently
|
#define PMTK_STANDBY_SUCCESS "$PMTK001,161,3*36" // Not needed currently
|
||||||
|
|
@ -116,7 +119,13 @@ class Adafruit_GPS {
|
||||||
|
|
||||||
uint8_t hour, minute, seconds, year, month, day;
|
uint8_t hour, minute, seconds, year, month, day;
|
||||||
uint16_t milliseconds;
|
uint16_t milliseconds;
|
||||||
float latitude, longitude, geoidheight, altitude;
|
// Floating point latitude and longitude value in degrees.
|
||||||
|
float latitude, longitude;
|
||||||
|
// Fixed point latitude and longitude value in 1/100000 degrees.
|
||||||
|
// For example a latitude of 4,767.99916 degrees would have a value of 476799916.
|
||||||
|
// More precise than the floating point value, but a little more difficult to use.
|
||||||
|
int32_t latitude_fixed, longitude_fixed;
|
||||||
|
float geoidheight, altitude;
|
||||||
float speed, angle, magvariation, HDOP;
|
float speed, angle, magvariation, HDOP;
|
||||||
char lat, lon, mag;
|
char lat, lon, mag;
|
||||||
boolean fix;
|
boolean fix;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue