IniSat Modèle 1 Version 2 TP 5 : Station Sol Exo 1 : Enregistrement GPS sur carte SD Exo 2 : Mise en place d'un protocole de communication avec la station sol

Dependencies:   mbed

Revision:
1:5fcc88ae8ad4
Parent:
0:278eba15d90b
--- a/gps.h	Wed Jul 07 11:39:10 2021 +0000
+++ b/gps.h	Tue May 31 13:38:23 2022 +0000
@@ -117,23 +117,31 @@
 }
 
 void Envoi_GPS(void) {
+
     if(gps.fixe) {
-//        pc.printf("GPS: %s\n\r",buffer);
-//            pc.printf("hms : %s\n",gps.horaire);
-        pc.printf("lat : %fN\n",gps.latitude);
-        pc.printf("long: %fE\n",gps.longitude);
+        pc.printf("hms : %s\n",gps.horaire);
+        pc.printf("lat : %f N\n",gps.latitude);
+        pc.printf("long: %f E\n",gps.longitude);
         pc.printf("alt : %d m\n",gps.altitude);
-            
-/*        if (cmd[0] == 'E') {      // lancer l'enregistrement    
-            FILE *fp = fopen("/sd/gps_data.txt", "a");
-        }
-//        fprintf(fp, "%.6f, %.6f, \n",gps.latitude,gps.longitude);
-        
-        
-        if (cmd[0] == 'S') {      // stopper l'enregistrement    
-            fclose(fp);
-        }*/
     }
+    else
+        pc.printf("GPS: %s\n",buffer);
+}
+
+void XBee_Envoi_GPS(void) {
+    
+    if(gps.fixe) {
+        xbee.printf("H%s\n",gps.horaire);
+        xbee.printf("lat : %fN\n",gps.latitude);
+        xbee.printf("long: %fE\n",gps.longitude);
+        xbee.printf("#A%d\n",gps.altitude);
+              
+        FILE *fp = fopen("/sd/gps_data.txt", "a");
+        fprintf(fp, "%.6f, %.6f, \n",gps.latitude,gps.longitude);   
+        fclose(fp);
+    }
+    else
+        xbee.printf("GPS: %s\n\r",buffer);
 }
 //==============================================================================
 // Sélection de la trame GGA - Système de positionnement global des données fixées