Dependents:   Lab3_Surveillance 6adcSerial

Files at this revision

API Documentation at this revision

Comitter:
keerthanasp
Date:
Fri Feb 04 13:13:32 2011 +0000
Parent:
3:ad00bddd493f
Commit message:

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ad00bddd493f -r c5d054086f2c GPS.cpp
--- a/GPS.cpp	Tue Feb 01 16:08:08 2011 +0000
+++ b/GPS.cpp	Fri Feb 04 13:13:32 2011 +0000
@@ -11,14 +11,14 @@
     
     while(1){
         getline();
-        if(scanf(msg, "GPGGA,%f,%f,%c,%f,%c,%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;
                 return 0;
             } else {
-                if(ns =='s') {  latitude   *= -1.0; }
-                if(ew =='w') {  longitude  *= -1.0; }
+                if(ns =='S') {  latitude   *= -1.0; }
+                if(ew =='W') {  longitude  *= -1.0; }
                 float degrees = trunc(latitude / 100.0f);
                 float minutes = latitude - (degrees * 100.0f);
                 latitude = degrees + minutes / 60.0f;