this program is designed for the CHITISAT's OBC, and is a prototype for the flight plan vs altitude

Dependencies:   ADS1015 BMP280 SDFileSystem SENSOR mbed

Files at this revision

API Documentation at this revision

Comitter:
FannyCalle
Date:
Fri Aug 17 17:58:25 2018 +0000
Parent:
4:c2bdc2bced76
Commit message:
this program is designed for the CHITISAT's OBC, and is a prototype for the flight plan vs altitude.

Changed in this revision

ADS1015.lib Show annotated file Show diff for this revision Revisions of this file
BMP280.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
SENSOR.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ADS1015.lib	Tue Jun 26 20:04:47 2018 +0000
+++ b/ADS1015.lib	Fri Aug 17 17:58:25 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/arve0/code/ADS1015/#9970e4a3007e
+https://os.mbed.com/users/FannyCalle/code/ADS1015/#9970e4a3007e
--- a/BMP280.lib	Tue Jun 26 20:04:47 2018 +0000
+++ b/BMP280.lib	Fri Aug 17 17:58:25 2018 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/12104404/code/BMP280/#23149ed904d4
+https://os.mbed.com/users/FannyCalle/code/BMP280/#23149ed904d4
--- a/SDFileSystem.lib	Tue Jun 26 20:04:47 2018 +0000
+++ b/SDFileSystem.lib	Fri Aug 17 17:58:25 2018 +0000
@@ -1,1 +1,1 @@
-SDFileSystem#8214896432e0
+https://os.mbed.com/users/FannyCalle/code/SDFileSystem/#8214896432e0
--- a/SENSOR.lib	Tue Jun 26 20:04:47 2018 +0000
+++ b/SENSOR.lib	Fri Aug 17 17:58:25 2018 +0000
@@ -1,1 +1,1 @@
-SENSOR#d8487cc76ee2
+https://os.mbed.com/users/FannyCalle/code/SENSOR/#d8487cc76ee2
--- a/main.cpp	Tue Jun 26 20:04:47 2018 +0000
+++ b/main.cpp	Fri Aug 17 17:58:25 2018 +0000
@@ -39,6 +39,7 @@
 void filtro_pasa_bajos(void);
 float get_altura(void);
 int guardar(int);
+void prog_camara(void);
 //declaracion de constntes
 #define enc 0xA0    //'160'  
 #define stby 0xA1   //'161' 
@@ -79,7 +80,7 @@
     float P0;
     float dif;
 //*********************************************
-//**********interruobcion activada por el rx de sistema de comunicaciones(sc)
+//**********interrupcion activada por el rx de sistema de comunicaciones(sc)
 void callback(){
     uint8_t menr=sc.getc();
     if(menr==nak || menr==tc ||menr==com){  //condicional para solo reconocer 3 comandos que puede llegar del sc 
@@ -95,15 +96,10 @@
     //******* inicio
     obc.printf("iniciando sensores:\n");
     //encenciendo sensores
-    wait(2);
+    //wait(2);
     Vcondicional=0;
     //iniciando camara    
-        camera=1;
-        led=1;
-        wait(2);
-        camera=0;
-        led=0;
-        wait(1);
+        prog_camara();
         obc.printf("iniciando camara\n\r");
     //******* condiciones iniciales
     obc.printf("iniciando sistema");
@@ -222,11 +218,7 @@
         }
     //******* OFF MODE
     //camara=1;       // apagando camara
-        wait(0.5);
-        camera=0;
-        wait(1);
-        camera=1;
-        wait(3);
+        prog_camara();
         obc.printf("apagando camara\n\r");
     led=0;
     Vcondicional=1; //apagando sensores
@@ -322,8 +314,8 @@
         BR=1;// abbrir documento de condiciones iniciles y cambiar Br para doocumentar el resetprogramado
                     NVIC_SystemReset();
         }
-        fprintf(fp,"%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %d %d %d %d %d %f\r\n",imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
-        obc.printf("%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %d %d %d %d %d %f\r\n",imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
+        fprintf(fp,"%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %d %d %d %d %d %f\r\n",imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
+        obc.printf("%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %d %d %d %d %d %f\r\n",imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
     fclose(fp);  
     obc.printf("guardando telemetria\n");
     }
@@ -343,8 +335,8 @@
     int barometro;
     barometro=ceil(P*100);    //tomando los 20 bits sin procesar del barometro
     bar=barometro;
-    obc.printf("p=%f barometro= %d bar= %d temp0= %d \n\r",P,barometro,bar,temp[0]);
-    wait(1);
+   // obc.printf("p=%f barometro= %d bar= %d temp0= %d \n\r",P,barometro,bar,temp[0]);
+   // wait(1);
     uint16_t y,z,y2,z4,ah,al;
     uint32_t par[3];// para los tres pares de datos de 32 bits
     uint32_t y4,y3;
@@ -357,8 +349,8 @@
         z4=0x000000ff;
         //completando a paquetes de 32 bits
         par[0]=(bar<<12)|temp[0];
-        obc.printf("par 0=%d",par[0]);
-        wait(1);
+        //obc.printf("par 0=%d",par[0]);
+        //wait(1);
         ah=sen_adc[1]&y;
         al=sen_adc[1]&z;
         ah=(ah>>4);
@@ -593,7 +585,7 @@
             fprintf(pp,"%f %f %f inicio\r\n",t.read(),BMPTemp,Pi);
             fclose(pp);
             led=1;
-            wait(1);
+            //wait(1);
         }
         else{BR=0;
         }
@@ -621,7 +613,7 @@
         {
             FILE *pp=fopen(file,"a");
             if (pp == NULL) {printf("no se inicion 5...");}
-            fprintf(pp,"%d %d %d %d %d %d %d %d %d %f %f %d %d %d %d %d %d %d\r\n",t.read(),imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
+            fprintf(pp,"%f %d %d %d %d %d %d %d %d %d %f %f %d %d %d %d %d %d %f\r\n",t.read(),imu[0],imu[1],imu[2],imu[3],imu[4],imu[5],imu[6],imu[7],imu[8],press,temperature,temp[1],sen_adc[0],sen_adc[1],sen_adc[2],suv,h);
             fclose(pp);
             return (2);
         }
@@ -629,9 +621,19 @@
         {
             FILE *pp=fopen(file,"a");
             if (pp == NULL) {printf("no se inicion 5...");}
-            fprintf(pp,"%f %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \r\n",t.read(),trama[0],trama[1],trama[2],trama[3],trama[4],trama[5],trama[6],trama[7],trama[8], trama[9],trama[10],trama[11],trama[12],trama[13],trama[14],trama[15],trama[16],trama[17],trama[18], trama[19],trama[20],trama[21],trama[22],trama[23],trama[24],trama[25],trama[26],trama[27],trama[28], trama[29], trama[30]);
+            fprintf(pp,"%f %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %f %f\r\n",t.read(),trama[0],trama[1],trama[2],trama[3],trama[4],trama[5],trama[6],trama[7],trama[8], trama[9],trama[10],trama[11],trama[12],trama[13],trama[14],trama[15],trama[16],trama[17],trama[18], trama[19],trama[20],trama[21],trama[22],trama[23],trama[24],trama[25],trama[26],trama[27],trama[28], trama[29], trama[30], h, altura1);
             fclose(pp);
             return (2);
         }
     }
+}
+void prog_camara(void)
+{
+        led=0;
+        camera=1;
+        wait(1);
+        camera=0;
+        led=1;
+        wait(2);
+        camera=1;
 }
\ No newline at end of file