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
Diff: main.cpp
- Revision:
- 1:5fcc88ae8ad4
- Parent:
- 0:278eba15d90b
diff -r 278eba15d90b -r 5fcc88ae8ad4 main.cpp --- a/main.cpp Wed Jul 07 11:39:10 2021 +0000 +++ b/main.cpp Tue May 31 13:38:23 2022 +0000 @@ -38,6 +38,7 @@ Init_Soft_UART(); // thread_sleep_for(1000); xb_ptr = 0; + cmd[0] = 'P'; // Controle montant par PC // Setup a serial interrupt function to receive data xbee.attach(&Rx_interrupt, Serial::RxIrq); __enable_irq(); @@ -68,8 +69,8 @@ if(fp == NULL) { error("Erreur : fichier non accessible en ecriture\n"); } - pc.printf("Fichier cree!\r\n"); - xbee.printf("Liaison Sol\r\n"); + pc.printf("Carte SD Ok!\r\n"); + xbee.printf("Station Sol par XBee Ok!\r\n"); // Write text in file // fprintf(fp, "Hello World, greats from Inisat!"); @@ -123,13 +124,23 @@ // Mode Radio : Transmission de données // Mise en forme pour affichage case 3: - Envoi_GPS(); - Envoi_Mes_Bat(); -// Envoi_Mes_SP(); -// Envoi_Mes_Temp(); - -// thread_sleep_for(1000); -// wait_ms(1000); + switch (cmd[0]) { // Commn + case 'P': { // Commande montante filaire + Envoi_GPS(); + Envoi_Mes_Bat(); +// Envoi_Mes_SP(); + Envoi_Mes_Temp(); + break; } + case 'X': // Commande montante sans fil par XBee + XBee_Envoi_GPS(); + XBee_Envoi_Mes_Bat(); +// XBee_Envoi_Mes_SP(); + XBee_Envoi_Mes_Temp(); + break; + default: + cmd[0] = 'P'; + break; + } etat = 1; break; /******************************************************************************/ @@ -186,6 +197,7 @@ { cmd[0] = xb_buf[1]; xbee.printf("#%c\r\n",cmd[0]+0x20); // Acquittement + param[0] = xb_buf[2]; } // xb_ok = 1; // Trame disponible pour décodage // pc.printf("%s\n\r",buffer); // Echo