Terry Koziniec / Mbed OS SatChat-GPS-test

Dependencies:   USBDevice max32630fthr

Files at this revision

API Documentation at this revision

Comitter:
koziniec
Date:
Sat Jul 01 12:31:17 2017 +0000
Parent:
9:b8a60ade343e
Child:
11:a9c16968e7f6
Commit message:
Milestone; GPS turns on. Waits for a fix, dumps to pc.serial and turns off GPS

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Jul 01 07:57:16 2017 +0000
+++ b/main.cpp	Sat Jul 01 12:31:17 2017 +0000
@@ -69,10 +69,6 @@
             char *token;
             token = strtok(nmea_sentence, ",");
             if (strcmp(token,gprmc) == 0) {     //GPRMC ?
-               // gps_power(off);                 //Yes - No need for GPS now
-               // while (gps.readable()){
-               //     char dummy = gps.getc();    //Empty serial buffer because overflows reveal MBED bugs :-(
-               // }  
                 pc.printf( " %s\n\r", token );  //Get the time
                 if (token != NULL) {
                     token = strtok(NULL, ",");
@@ -80,14 +76,58 @@
                 }
                 if (token != NULL) {
                     token = strtok(NULL, ",");
-                    pc.printf("Valid: %s\n\r",token);
+                    if (*token == 'V') {
+                        pc.printf("VOID");
+                    }
                 }
-                //If valid, get the rest of the tokens and pass to static variable.
-                
+                if (*token == 'A') {
+                    pc.printf("Got a fix\n\r");
+                    gps_power(off);                 //Yes - No need for GPS now
+                    while (gps.readable()) {
+                        char dummy = gps.getc();    //Empty serial buffer because overflows reveal MBED bugs :-(
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("Latitude: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("North/South: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("Longitude: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("East/West: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("Speed in knots: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("True course: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("Date: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("Variation: %s\n\r",token);
+                    }
+                    if (token != NULL) {
+                        token = strtok(NULL, ",");
+                        pc.printf("East/West: %s\n\r",token);
+                    }
+                }
+
             }
         }
 
- 
+
 
 
         while (gps.readable()) {