GPS精度実験
Fork of MBed_Adafruit-GPS-Library by
Diff: MBed_Adafruit_GPS.cpp
- Revision:
- 2:8203e954d8e1
- Parent:
- 1:ff72e93bcb0e
- Child:
- 4:7ef0dd12940c
--- a/MBed_Adafruit_GPS.cpp Tue May 20 14:51:14 2014 +0000 +++ b/MBed_Adafruit_GPS.cpp Wed Jun 18 13:49:56 2014 +0000 @@ -60,10 +60,21 @@ milliseconds = fmod((double) timef, 1.0) * 1000; // parse out latitude + /* p = strchr(p, ',')+1; latitudeH = atol(p); p = strchr(p, '.')+1; latitudeL = atol(p); + */ + + p = strchr(p, ',')+1; + long sub_latitudeH = atol(p); + p = strchr(p, '.')+1; + long sub_latitudeL = atol(p); + + latitudeH = sub_latitudeH / 100; + latitudeL = ((sub_latitudeH % 100) *10000) + sub_latitudeL; + p = strchr(p, ',')+1; if (p[0] == 'N') lat = 'N'; @@ -72,10 +83,20 @@ else return false; // parse out longitude - p = strchr(p, ',')+1; + /*p = strchr(p, ',')+1; longitudeH = atol(p); p = strchr(p, '.')+1; longitudeL = atol(p); + */ + + p = strchr(p, ',')+1; + long sub_longitudeH = atol(p); + p = strchr(p, '.')+1; + long sub_longitudeL = atol(p); + + longitudeH = sub_longitudeH / 100; + longitudeL = ((sub_longitudeH % 100) *10000) + sub_longitudeL; + p = strchr(p, ',')+1; if (p[0] == 'W') lon = 'W'; @@ -123,10 +144,21 @@ return false; // parse out latitude + /* p = strchr(p, ',')+1; latitudeH = atol(p); p = strchr(p, '.')+1; latitudeL = atol(p); + */ + + p = strchr(p, ',')+1; + long sub_latitudeH = atol(p); + p = strchr(p, '.')+1; + long sub_latitudeL = atol(p); + + latitudeH = sub_latitudeH / 100; + latitudeL = ((sub_latitudeH % 100) *10000) + sub_latitudeL; + p = strchr(p, ',')+1; if (p[0] == 'N') lat = 'N'; @@ -135,10 +167,22 @@ else return false; // parse out longitude + /* p = strchr(p, ',')+1; longitudeH = atol(p); p = strchr(p, '.')+1; longitudeL = atol(p); + */ + + p = strchr(p, ',')+1; + long sub_longitudeH = atol(p); + p = strchr(p, '.')+1; + long sub_longitudeL = atol(p); + + longitudeH = sub_longitudeH / 100; + longitudeL = ((sub_longitudeH % 100) *10000) + sub_longitudeL; + + p = strchr(p, ',')+1; if (p[0] == 'W') lon = 'W';