programme GPS pour ERS4

Dependencies:   mbed

Fork of GPS_IUT_Nice by tito tito

Revision:
1:f24af888e699
Parent:
0:2c0686a07ab8
diff -r 2c0686a07ab8 -r f24af888e699 GPS.cpp
--- a/GPS.cpp	Fri Nov 23 19:10:01 2012 +0000
+++ b/GPS.cpp	Fri Mar 11 10:18:09 2016 +0000
@@ -35,12 +35,12 @@
 
     while(1) {        
         getline();
-
+        //printf("long= %f %c  latitude= %f %c\n",&longitude, &ew, &latitude, &ns);
         // 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) {
                 longitude = 0.0;
-                latitude = 0.0;        
+                latitude = 0.0;       
                 return 0;
             } else {
                 if(ns == 'S') {    latitude  *= -1.0; }
@@ -62,15 +62,18 @@
         v*= -1.0;
         v = floor(v);
         v*=-1.0;
+        puts("3\n");
     } else {
         v = floor(v);
+        puts("4\n");
     }
     return v;
 }
 
 void GPS::getline() {
     while(_gps.getc() != '$');    // wait for the start of a line
-    for(int i=0; i<256; i++) {
+    //for(int i=0; i<256; i++) {
+    for(int i=0; i<512; i++) {
         msg[i] = _gps.getc();
         if(msg[i] == '\r') {
             msg[i] = 0;