201803_oshima_jodam_test

Dependencies:   BMP180 MPU6050 SDFileSystem mbed

Fork of SDFileSystem_HelloWorld by mbed official

Revision:
9:b10aaf72d100
Parent:
8:eb1ebae5f051
Child:
10:273500c77873
--- a/main.cpp	Tue Mar 06 13:04:18 2018 +0000
+++ b/main.cpp	Fri Mar 09 14:14:57 2018 +0000
@@ -23,7 +23,7 @@
 Serial          twe(p9,p10);
 Serial          gps(p13,p14);
 Serial          pc(USBTX,USBRX);
-PwmOut          servo_para(p23);
+PwmOut          servo_para(p22);
 
 LocalFileSystem local("local");
 FILE *fp;
@@ -104,6 +104,7 @@
     
     while(fly == 1);        //フライトピン抜けるまで待機
     
+    twe.printf("SEPARATE!!!!!!!\r\n");
     i = 0;
     Alt_buff[0] = 0;
     fp = fopen("/sd/mydir/sdtest.txt", "a");
@@ -162,7 +163,7 @@
         i = 0;
         if(tf_para == true){    //パラ開くまでは頂点判定
             Alt_buff[Cnt_buff+1] = Alt_now; 
-            if(Alt_buff[Cnt_buff]>Alt_buff[Cnt_buff+1]) Cnt_para++; //直前の値より小さければカウント+1
+            if(Alt_buff[Cnt_buff]-Alt_buff[Cnt_buff+1] > 1) Cnt_para++; //直前の値より小さければカウント+1
 //            twe.printf("Cnt_para:%d\r\n", Cnt_para); 
             Cnt_buff++;                   
             if(Cnt_para == 10 || t > TIMER){    //頂点!!!
@@ -173,8 +174,9 @@
                 tf_para = false;
                 timer1.stop();
                 twe.printf("PARA_OPEN\r\n");
-                i = 0;    
-                ochiru.attach(_recovery,0.1);   //パラメータ保存のためのやつ
+                twe.printf("GPS_MODE_ON!!!!\r\n");
+                    
+                ochiru.attach(_recovery,0.2);   //パラメータ保存のためのやつ
                 
             }
         }
@@ -197,11 +199,11 @@
     Alt_now = get_Alt(pressure, temperature);
     Alt_now = Alt_now - Alt_gnd;
     fprintf(fp, "%f,%f,%f,%f,%f,%f,%f\r\n",Alt_now,a[0],a[1],a[2],d[0],d[1],d[2]);
-    Cnt_buff++;
+    i++;
     
     if(i == 50){
         fclose(fp);
-        Cnt_buff = 0;
+        i = 0;
     }
 }
 float get_Alt(float press, float temp){
@@ -238,8 +240,8 @@
 
 void _para(int motion){
     if(motion==UNLOCK){
-            servo_para.pulsewidth(0.0005); // pulse servo out sita
+            servo_para.pulsewidth(0.001); // pulse servo out sita
     }else if(motion==LOCK){
-            servo_para.pulsewidth(0.0025); // pulse servo outu sita     
+            servo_para.pulsewidth(0.002); // pulse servo outu sita     
     }
 }
\ No newline at end of file