Add fixed point minute scaling back with correct floating point conversion.
This commit is contained in:
parent
7ca1d78daa
commit
240f1bbdea
|
|
@ -72,9 +72,9 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
p += 3; // skip decimal point
|
p += 3; // skip decimal point
|
||||||
strncpy(degreebuff + 2, p, 4);
|
strncpy(degreebuff + 2, p, 4);
|
||||||
degreebuff[6] = '\0';
|
degreebuff[6] = '\0';
|
||||||
long minutes = atol(degreebuff) * 10;
|
long minutes = 50 * atol(degreebuff) / 3;
|
||||||
latitude_fixed = degree + minutes;
|
latitude_fixed = degree + minutes;
|
||||||
latitude = latitude_fixed / 100000.0F;
|
latitude = degree / 100000 + minutes * 0.000006F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'N') lat = 'N';
|
if (p[0] == 'N') lat = 'N';
|
||||||
|
|
@ -92,9 +92,9 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
p += 3; // skip decimal point
|
p += 3; // skip decimal point
|
||||||
strncpy(degreebuff + 2, p, 4);
|
strncpy(degreebuff + 2, p, 4);
|
||||||
degreebuff[6] = '\0';
|
degreebuff[6] = '\0';
|
||||||
minutes = atol(degreebuff) * 10;
|
minutes = 50 * atol(degreebuff) / 3;
|
||||||
longitude_fixed = degree + minutes;
|
longitude_fixed = degree + minutes;
|
||||||
longitude = longitude_fixed / 100000.0F;
|
longitude = degree / 100000 + minutes * 0.000006F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'W') lon = 'W';
|
if (p[0] == 'W') lon = 'W';
|
||||||
|
|
@ -151,9 +151,9 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
p += 3; // skip decimal point
|
p += 3; // skip decimal point
|
||||||
strncpy(degreebuff + 2, p, 4);
|
strncpy(degreebuff + 2, p, 4);
|
||||||
degreebuff[6] = '\0';
|
degreebuff[6] = '\0';
|
||||||
long minutes = atol(degreebuff) * 10;
|
long minutes = 50 * atol(degreebuff) / 3;
|
||||||
latitude_fixed = degree + minutes;
|
latitude_fixed = degree + minutes;
|
||||||
latitude = latitude_fixed / 100000.0F;
|
latitude = degree / 100000 + minutes * 0.000006F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'N') lat = 'N';
|
if (p[0] == 'N') lat = 'N';
|
||||||
|
|
@ -171,9 +171,9 @@ boolean Adafruit_GPS::parse(char *nmea) {
|
||||||
p += 3; // skip decimal point
|
p += 3; // skip decimal point
|
||||||
strncpy(degreebuff + 2, p, 4);
|
strncpy(degreebuff + 2, p, 4);
|
||||||
degreebuff[6] = '\0';
|
degreebuff[6] = '\0';
|
||||||
minutes = atol(degreebuff) * 10;
|
minutes = 50 * atol(degreebuff) / 3;
|
||||||
longitude_fixed = degree + minutes;
|
longitude_fixed = degree + minutes;
|
||||||
longitude = longitude_fixed / 100000.0F;
|
longitude = degree / 100000 + minutes * 0.000006F;
|
||||||
|
|
||||||
p = strchr(p, ',')+1;
|
p = strchr(p, ',')+1;
|
||||||
if (p[0] == 'W') lon = 'W';
|
if (p[0] == 'W') lon = 'W';
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,9 @@ class Adafruit_GPS {
|
||||||
uint16_t milliseconds;
|
uint16_t milliseconds;
|
||||||
// Floating point latitude and longitude value in degrees.
|
// Floating point latitude and longitude value in degrees.
|
||||||
float latitude, longitude;
|
float latitude, longitude;
|
||||||
// Fixed point latitude and longitude value in 1/100000 degrees.
|
// Fixed point latitude and longitude value with degrees stored in units of 1/100000 degrees,
|
||||||
// For example a latitude of 4,767.99916 degrees would have a value of 476799916.
|
// and minutes stored in units of 1/100000 degrees. See pull #13 for more details:
|
||||||
// More precise than the floating point value, but a little more difficult to use.
|
// https://github.com/adafruit/Adafruit-GPS-Library/pull/13
|
||||||
int32_t latitude_fixed, longitude_fixed;
|
int32_t latitude_fixed, longitude_fixed;
|
||||||
float geoidheight, altitude;
|
float geoidheight, altitude;
|
||||||
float speed, angle, magvariation, HDOP;
|
float speed, angle, magvariation, HDOP;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue