2017.11伊豆大島共同打ち上げ実験の開放用プログラム

Dependencies:   BMP180 MPU6050 mbed

Fork of Sample_BMP180 by CORE

Revision:
8:b10169df8f5f
Parent:
7:4efaca1e9acd
--- a/main.cpp	Sat Nov 04 01:08:35 2017 +0000
+++ b/main.cpp	Fri Nov 10 12:43:15 2017 +0000
@@ -4,10 +4,10 @@
 #include "BMP180.h"
 
 #define LAUNCH_JUDGE_ACC_g  3.0
-#define PARA_OPEN_TIME_s    10.0
+#define PARA_OPEN_TIME_s    20.0
 #define PARA_OPEN_CNT       7
-#define PARA_OPEN_FILTER_s  6.0
-#define LEAF_UNLOCK_TIME_s  10.0
+#define PARA_OPEN_FILTER_s  8.0
+#define LEAF_UNLOCK_TIME_s  85.0
 #define LEAF_UNLOCK_ALT_m   300.0
 #define p0                  1013.25f
 
@@ -20,8 +20,8 @@
 PwmOut          sg92(dp18);
 DigitalIn       oshirase1(dp11);
 DigitalInOut    oshirase2(dp10);
-DigitalOut      myled(LED1);
-//Serial        pc(USBTX,USBRX);
+//DigitalOut      myled(LED1);
+//Serial          pc(USBTX,USBRX);
 
 /*  自作関数    */
 void    _flight();
@@ -45,7 +45,7 @@
 
 
 int main() {
-//    pc.printf("Hello!");
+//    pc.printf("Hello!\r\n");
     mg996.period_ms(20);
     sg92.period_ms(20);
     mpu.setAcceleroRange(0);
@@ -86,6 +86,7 @@
 
 /*  フライトモード用関数  */
 void _flight(){
+//    pc.printf("flight mode on\r\n");
     oshirase2.output();
     oshirase2 = 0;
     _close();
@@ -96,20 +97,21 @@
         Alt_buff[i] = _getAlt();
     }
     Land_Alt = _median(Alt_buff,10);
+//    pc.printf("Land_Alt = %f\r\n",Land_Alt);
 //    for(int i=0;i<10;i++)pc.printf("%f\n\r",Alt_buff[i]);
 
     /*  発射判定    */
     while(1){
-        myled = !myled;
+//        myled = !myled;
         for(int i=0;i<10;i++){
-            Acc = _getAcc();
-            Acc_buff[i] = Acc;
+            Acc_buff[i] = _getAcc();
         }
         Acc = _median(Acc_buff,10);
         if(Acc >= LAUNCH_JUDGE_ACC_g){
             para_timer.start();
             oshirase2 = 1;
 //            for(int i=0;i<10;i++)pc.printf("%f\n\r",Acc_buff[i]);
+//            pc.printf("Acc = %f\r\n",Acc);
             break;
         }
     }
@@ -136,6 +138,7 @@
                 leaf_timer.start();
                 oshirase2 = 0;
                 para_timer.stop();
+//                pc.printf("para open\r\n");
 //                for(int i=0;i<10;i++)pc.printf("%f\n\r",Alt_buff[i]);
                 break;
             }
@@ -152,6 +155,7 @@
             _leaf_unlock();
             oshirase2 = 1;
             leaf_timer.stop();
+//            pc.printf("leafing unlock\r\n");
 //            for(int i=0;i<10;i++)pc.printf("%f\n\r",Alt_buff[i]);
             break;
         }
@@ -160,10 +164,10 @@
 
 
 /*  サーボ用関数  */
-void _close() {mg996.pulsewidth(0.0010);}
-void _open() {mg996.pulsewidth(0.0020);}
-void _leaf_lock() {sg92.pulsewidth(0.0010);}
-void _leaf_unlock() {sg92.pulsewidth(0.0020);}
+void _close() {mg996.pulsewidth(0.0005);}
+void _open() {mg996.pulsewidth(0.0024);}
+void _leaf_lock() {sg92.pulsewidth(0.0024);}
+void _leaf_unlock() {sg92.pulsewidth(0.0005);}
 
 
 /*  高度取得関数    */