Example code for reading from a serial GPS unit & parsing an RMC GPS string to a struct.

Dependencies:   mbed

Fork of mbed_blinky by Mbed

Files at this revision

API Documentation at this revision

Comitter:
HackerLabATTKit01
Date:
Thu Mar 09 22:31:06 2017 +0000
Parent:
18:7ba014531492
Child:
20:a728f1075fb1
Commit message:
Fixed decimal issue in parsing

Changed in this revision

GPRMCSentence.h Show annotated file Show diff for this revision Revisions of this file
--- a/GPRMCSentence.h	Thu Mar 09 21:57:29 2017 +0000
+++ b/GPRMCSentence.h	Thu Mar 09 22:31:06 2017 +0000
@@ -105,7 +105,7 @@
         (gprmcstr[5] == 'C') &&
         (gprmcstr[6] == ',')) {
         pos = parseStringToGPRMCStructEntry(gprmcstr,gprmstruct->time,pos,TIMEMAX);
-        //pos = parseStringToGPRMCStructEntry(gprmcstr,devnull,pos,DEVNULMAX); // to get rid of time decimal, needed for some gps modules
+        if (gprmcstr[pos] != ',') pos = parseStringToGPRMCStructEntry(gprmcstr,devnull,pos,DEVNULMAX); // to get rid of time decimal, needed for some gps modules
         if (gprmcstr[pos] != ',') {gprmstruct->status = gprmcstr[pos];pos++;}
         else gprmstruct->status = '\0';
         pos++;