PROGRAMA SIMPLE QUE LEE UNA TRAMA DE GPS Y LA PONE EN PANTALLA DE LA TERMINAL DEL PC

Dependents:   GPS_7 GPSCELU_Grupo8 Tarea_GPS_viaGSM pruebacel ... more

Fork of GPS by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
tony63
Date:
Mon Apr 27 02:08:24 2015 +0000
Parent:
1:df8295aa2b2b
Commit message:
cordenadas de gps en enteros para google maps

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r df8295aa2b2b -r 8d7c7165ffe2 GPS.cpp
--- a/GPS.cpp	Mon Oct 20 05:39:22 2014 +0000
+++ b/GPS.cpp	Mon Apr 27 02:08:24 2015 +0000
@@ -35,28 +35,31 @@
 
     while(1) {        
         getline();
-
+      //$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
         // 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) {
+            if(!lock) {   //si lock es 1  hay lecturas ok
                 longitude = 0.0;
                 latitude = 0.0;        
                 return 0;
-            } else {
+            } 
+                else {
                 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;    
-                degrees = trunc(longitude / 100.0f * 0.01f);
-                minutes = longitude - (degrees * 100.0f);
-                longitude = degrees + minutes / 60.0f;
+                latitude = (latitude / 100.0f);
+                //float minutes = latitude - (degrees * 100.0f);
+                //latitude = degrees + minutes / 60.0f;    
+                longitude = (longitude / 100.0f);
+                //minutes = longitude - (degrees * 100.0f);
+                //longitude = degrees + minutes / 60.0f;
+                
                 return 1;
             }
         }
     }
 }
 
+/*
 float GPS::trunc(float v) {
     if(v < 0.0) {
         v*= -1.0;
@@ -67,7 +70,7 @@
     }
     return v;
 }
-
+*/
 void GPS::getline() {
     while(_gps.getc() != '$');    // wait for the start of a line
     for(int i=0; i<256; i++) {