Library for ublox neo 6m FIXED

Dependents:   Geofence_sender Geofence_sender

Fork of GPS by Thanawat Phattaraworamet

Files at this revision

API Documentation at this revision

Comitter:
13beeuishfaq
Date:
Thu Dec 31 16:29:57 2015 +0000
Parent:
0:8f2e256775d7
Commit message:
Fixed an issue which was giving false GPS Coordinates

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8f2e256775d7 -r 3be54600b19d GPS.cpp
--- a/GPS.cpp	Mon May 04 03:41:27 2015 +0000
+++ b/GPS.cpp	Thu Dec 31 16:29:57 2015 +0000
@@ -65,14 +65,7 @@
        // if (sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%*d,%*d, %*f,%*f,%*f,%*f,%*f,%*f,%d ", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) {
         if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) { 
 
-            if (!lock) 
-            {
-                longitude = 0.0;
-                latitude = 0.0;
-                utc=0.0;
-                return 0;
-            } 
-            else 
+            if (lock==1) 
             {
                 if (ns == 'S') {
                     latitude  *= -1.0;
@@ -88,8 +81,17 @@
                 longitude = degrees + minutes / 60.0f;
                 utc=time;
                 return 1;
+                
+            } 
+            else 
+            {
+                longitude = 0.0;
+                latitude = 0.0;
+                utc=0.0;
+                return 0;
             }
-        }  
+        }
+        else  
         return 0;
     }
 }