GPS精度実験
Fork of MBed_Adafruit-GPS-Library by
Diff: MBed_Adafruit_GPS.cpp
- Revision:
- 7:3f389529228e
- Parent:
- 6:7b7e9dc49edd
- Child:
- 8:f1c5757af8dd
diff -r 7b7e9dc49edd -r 3f389529228e MBed_Adafruit_GPS.cpp --- a/MBed_Adafruit_GPS.cpp Wed Sep 14 11:01:52 2016 +0000 +++ b/MBed_Adafruit_GPS.cpp Thu Oct 06 15:29:58 2016 +0000 @@ -50,7 +50,11 @@ // found GSA char *p = nmea; GPGSAdata = nmea; - printf("%s",nmea); + if(count_[0] == 1){ + printf("%s\n",nmea); + count_[0] = 0; + } + //printf("%s\n",GPGSAdata); return true; } @@ -60,8 +64,12 @@ // found GGA char *p = nmea; GPGGAdata = nmea; - printf("%s",nmea); - // get time + if(count_[1] == 1){ + printf("%s\n",nmea); + count_[1] = 0; + } + //printf("%s\n",GPGGAdata); + /* // get time p = strchr(p, ',')+1; float timef = atof(p); uint32_t time = timef; @@ -78,7 +86,7 @@ p = strchr(p, '.')+1; latitudeL = atol(p); */ - + /* p = strchr(p, ',')+1; long sub_latitudeH = atol(p); p = strchr(p, '.')+1; @@ -100,7 +108,7 @@ p = strchr(p, '.')+1; longitudeL = atol(p); */ - +/* p = strchr(p, ',')+1; long sub_longitudeH = atol(p); p = strchr(p, '.')+1; @@ -130,15 +138,19 @@ p = strchr(p, ',')+1; p = strchr(p, ',')+1; geoidheight = atof(p); + */ return true; } if (strstr(nmea, "$GPRMC")) { // found RMC char *p = nmea; - this->GPRMCdata = nmea; - printf("%s",nmea); + GPRMCdata = nmea; + if(count_[2] == 1){ + printf("%s\n",nmea); + count_[2] = 0; + } // get time - p = strchr(p, ',')+1; +/* p = strchr(p, ',')+1; float timef = atof(p); uint32_t time = timef; hour = time / 10000; @@ -163,7 +175,7 @@ p = strchr(p, '.')+1; latitudeL = atol(p); */ - +/* p = strchr(p, ',')+1; long sub_latitudeH = atol(p); p = strchr(p, '.')+1; @@ -186,7 +198,7 @@ p = strchr(p, '.')+1; longitudeL = atol(p); */ - +/* p = strchr(p, ',')+1; long sub_longitudeH = atol(p); p = strchr(p, '.')+1; @@ -216,10 +228,43 @@ day = fulldate / 10000; month = (fulldate % 10000) / 100; year = (fulldate % 100); - +*/ // we dont parse the remaining, yet! return true; } + if (strstr(nmea, "$GPGSV")) { + // found GSV + char *p = nmea; + GPGSVdata = nmea; + char flag = GPGSVdata[9]; + if(flag == '1'){ + GPGSVdataA = nmea; + GPGSVdataB = ""; + GPGSVdataC = ""; + GPGSVdataD = ""; + } + else if(flag == '2'){ + GPGSVdataB = nmea; + } + else if(flag == '3'){ + GPGSVdataC = nmea; + } + else if(flag == '4'){ + GPGSVdataD = nmea; + } + if(flag == GPGSVdata[7]){ + print_ok = 1; + } + else{ + print_ok = 0; + } + // printf("%s\n",GPGSVdata); + printf("%s\n",nmea); + count_[0] = 1; + count_[1] = 1; + count_[2] = 1; + return true; + } return false; }