Josmy Bar / Bus_Navigation

Dependents:   BusNavigation

Fork of GPS by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
josmy
Date:
Fri Oct 31 05:15:22 2014 +0000
Parent:
0:15611c7938a3
Commit message:
there are no changes in GPS library

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
GPS.h Show annotated file Show diff for this revision Revisions of this file
diff -r 15611c7938a3 -r 5c5177f8c0d8 GPS.cpp
--- a/GPS.cpp	Tue Jun 08 14:10:27 2010 +0000
+++ b/GPS.cpp	Fri Oct 31 05:15:22 2014 +0000
@@ -22,20 +22,21 @@
  
 #include "GPS.h"
 
+
 GPS::GPS(PinName tx, PinName rx) : _gps(tx, rx) {
-    _gps.baud(4800);    
+    _gps.baud(9600);    
     longitude = 0.0;
     latitude = 0.0;        
 }
 
 int GPS::sample() {
     float time;
-    char ns, ew;
+    //char ns, ew;
     int lock;
 
     while(1) {        
         getline();
-
+        
         // Check if it is a GPGGA msg (matches both locked and non-locked msg)
         if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) { 
             if(!lock) {
@@ -48,7 +49,8 @@
                 float degrees = trunc(latitude / 100.0f);
                 float minutes = latitude - (degrees * 100.0f);
                 latitude = degrees + minutes / 60.0f;    
-                degrees = trunc(longitude / 100.0f * 0.01f);
+                //degrees = trunc(longitude / 100.0f * 0.01f);
+                degrees = trunc(longitude / 100.0f );
                 minutes = longitude - (degrees * 100.0f);
                 longitude = degrees + minutes / 60.0f;
                 return 1;
diff -r 15611c7938a3 -r 5c5177f8c0d8 GPS.h
--- a/GPS.h	Tue Jun 08 14:10:27 2010 +0000
+++ b/GPS.h	Fri Oct 31 05:15:22 2014 +0000
@@ -45,6 +45,9 @@
     /** The latitude (call sample() to set) */
     float latitude;
     
+    char ns;
+    char ew;
+    
 private:
     float trunc(float v);
     void getline();