Agra-GPS / FreePilot_V2-3

Dependencies:   FreePilot PinDetect mbed-src

Fork of FreePilot_V2-2 by Agra-GPS

Revision:
50:07dfcda65732
Parent:
48:5d9c63364c94
Child:
55:8561b35130fc
--- a/gps.h	Sat Mar 14 02:00:23 2015 +0000
+++ b/gps.h	Sat Mar 14 15:44:33 2015 +0000
@@ -210,6 +210,7 @@
 
 bool nmea_rmc(char *s)
 {
+  //  pc.puts("\r\ngot a string!!!!\r\n");
     char *token;
     int  token_counter = 0;
     time_s   = (char *)NULL;
@@ -219,12 +220,13 @@
     trk    = (char *)NULL;
     magv   = (char *)NULL;
     magd   = (char *)NULL;
-    latit  = "";
-    longit = "";
+    latit  = (char *)NULL;
+    longit = (char *)NULL;
     latitude_s  = (char *)NULL;
     longitude_s = (char *)NULL;
     lat_dir   = (char *)NULL;
     lon_dir   = (char *)NULL;
+    
     while ((token = strsep(&s, ",")) != NULL) {
         switch (token_counter) {
             case 1:
@@ -234,10 +236,8 @@
                 stat   = token;
                 break;
             case 3:
-                if ( token ) {
                     latit  = token;
                     latitude_s  = token;
-                }
                 break;
             case 4:
                 lat_dir   = token;
@@ -267,7 +267,7 @@
         }
         token_counter++;
     }
-    if (stat!= '\0' && date!= '\0' && time_s!= '\0') {
+    if (string(stat) != "\0" && string(date) != "\0" && string(time_s) != "\0") {
         hour       = (char)((time_s[0] - '0') * 10) + (time_s[1] - '0');
         minute     = (char)((time_s[2] - '0') * 10) + (time_s[3] - '0');
         second     = (char)((time_s[4] - '0') * 10) + (time_s[5] - '0');
@@ -280,9 +280,9 @@
         speed_m_s = speed_km * 3600.0 / 1000.0;
         track      = atof(trk);
         magvar     = atof(magv);
-        return true;
+       // return true;
     }
-    if ( longit != '\0' && latit != '\0' ) {
+    if ( string(longit) != "\0" && string(latit) != "\0" ) {
         old_position = position;
         position.SetX(lat_to_deg(latitude_s,  lat_dir[0]));
         position.SetY(lon_to_deg(longitude_s, lon_dir[0]));