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

Dependencies:   BMP180 MPU6050 mbed

Fork of Sample_BMP180 by CORE

Revision:
5:a5cf6914e7c4
Parent:
4:ae20e73f4924
Child:
6:e0c25c3976ae
--- a/main.cpp	Sun Oct 22 04:36:54 2017 +0000
+++ b/main.cpp	Sun Oct 22 15:07:19 2017 +0000
@@ -4,8 +4,9 @@
 #include "BMP180.h"
 
 #define LAUNCH_JUDGE_ACC_g  3.0
-#define PARA_OPEN_TIME_s    5.0
-#define LEAF_UNLOCK_TIME_s  5.0
+#define PARA_OPEN_TIME_s    10.0
+#define PARA_OPEN_FILTER_s  6.0
+#define LEAF_UNLOCK_TIME_s  10.0
 #define LEAF_UNLOCK_ALT_m   300.0
 #define p0                  1013.25f
 
@@ -14,8 +15,8 @@
 Timer           para_timer;
 Timer           leaf_timer;
 Ticker          readtimer;
-PwmOut          mg996(dp1);
-PwmOut          sg92(dp2);
+PwmOut          mg996(dp18);
+PwmOut          sg92(dp1);
 DigitalIn       oshirase1(dp11);
 DigitalInOut    oshirase2(dp10);
 DigitalOut      myled(LED1);
@@ -50,6 +51,7 @@
     mpu.setAcceleroRange(0);
     bmp.Initialize(64,BMP180_OSS_ULTRA_LOW_POWER);
     oshirase2.input();
+    wait(0.5);
     while(1){
         if(oshirase1==0 && oshirase2==1){
             _flight();
@@ -118,13 +120,15 @@
             Alt_buff[i] = _getAlt();
             if(Alt_buff[i] < Alt_buff[i-1]) Alt_cnt++;
         }
-        if(Alt_cnt > 6 || para_timer.read() >= PARA_OPEN_TIME_s){
-            _open();
-            leaf_timer.start();
-            oshirase2 = 0;
-            para_timer.stop();
-//            for(int i=0;i<10;i++)pc.printf("%f\n\r",Alt_buff[i]);
-            break;
+        if(para_timer.read() >= PARA_OPEN_FILTER_s){
+            if(Alt_cnt > 6 || para_timer.read() >= PARA_OPEN_TIME_s){
+                _open();
+                leaf_timer.start();
+                oshirase2 = 0;
+                para_timer.stop();
+    //            for(int i=0;i<10;i++)pc.printf("%f\n\r",Alt_buff[i]);
+                break;
+            }
         }
     }