a

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of AutoFlight2018_Control by 航空研究会

Files at this revision

API Documentation at this revision

Comitter:
TUATBM
Date:
Fri Sep 07 09:38:53 2018 +0000
Parent:
0:813f5cd20cf1
Commit message:
a

Changed in this revision

config/falfalla.h 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
diff -r 813f5cd20cf1 -r 6e226505f05b config/falfalla.h
--- a/config/falfalla.h	Wed Sep 05 05:40:11 2018 +0000
+++ b/config/falfalla.h	Fri Sep 07 09:38:53 2018 +0000
@@ -25,7 +25,7 @@
 static float g_leftloopROLLshort=22.0;
 static float g_leftloopPITCHshort=-6.0;
 
-static float g_glideloopROLL = -16.0;
+static float g_glideloopROLL = -5.0;
 static float g_glideloopPITCH = 0.0;
 
 #if NUMBER_FALFALLA == 1    //1号機
diff -r 813f5cd20cf1 -r 6e226505f05b main.cpp
--- a/main.cpp	Wed Sep 05 05:40:11 2018 +0000
+++ b/main.cpp	Fri Sep 07 09:38:53 2018 +0000
@@ -1,4 +1,3 @@
-/*2018年度用機体制御基板プログラム_自動離着陸Modeは違うプログラム*/
 //mbed
 #include "mbed.h"
 #include "FATFileSystem.h"
@@ -24,7 +23,7 @@
 #define KP_ELE 2.0
 #define KI_ELE 0.0
 #define KD_ELE 0.0
-#define KP_RUD 3.0
+#define KP_RUD 8.0
 #define KI_RUD 0.0
 #define KD_RUD 0.0
 
@@ -155,6 +154,9 @@
 void SensingMPU();
 void UpdateDist();
 
+//割り込み処理
+void ISR_Serial_Rx();
+
 //void offsetRollPitch(float FirstROLL, float FirstPITCH);
 //void TransYaw(float FirstYAW);
 float TranslateNewYaw(float beforeYaw,  float newzeroYaw);
@@ -766,8 +768,6 @@
     static int16_t temppwm[6]={trimpwm[0],trimpwm[1],trimpwm[2],trimpwm[3],trimpwm[4]};
     static int16_t tempsbuspwm[5] = {trimpwm[0],trimpwm[1],trimpwm[2],trimpwm[3],trimpwm[4]};
     static int counter_abnormalpwm=0;
-    Timer t2;
-    int time;
     if(sbus.flg_ch_update == true){
         switch(output_status){    //マニュアルモード,自動モード,自動着陸もモードを切替
             case Manual:
@@ -797,17 +797,10 @@
                 break;
         
             case Auto:
-                t2.start();
-                
                 pwm[ELE] = autopwm[ELE];
                 pwm[THR] = autopwm[THR];
                 pwm[RUD] = autopwm[RUD];
                 pwm[DROP] = autopwm[DROP];
-                
-                if(t2.read()<10){
-                    pwm[THR]= minpwm[THR];
-                    }
-                t2.stop();
                 //pc.printf("update_auto\r\n");
                 break;
                 
@@ -1002,6 +995,11 @@
     targetAngle[ROLL] = g_glideloopROLL;
     targetAngle[PITCH] = g_glideloopPITCH;
     
+    autopwm[THR]=oldTHR;
+    //シリアル通信受信の割り込みイベント登録
+    //pc.attach(ISR_Serial_Rx, Serial::RxIrq);
+    
+/*    
     //時間計測開始設定
     if(!flg_tstart && CheckSW_Up(Ch7)){
         t_start = t.read();
@@ -1041,7 +1039,7 @@
             autopwm[THR] = 1180;
             THRcount = 0;
         }
-    }
+    }*/
 }
 
 //離陸-投下-着陸一連
@@ -1334,4 +1332,16 @@
     //pc.printf("%x ",sbus.failsafe_status);
     
     //pc.printf("\r\n");
+}
+
+void ISR_Serial_Rx()
+{
+    // シリアルの受信処理
+    char data = pc.getc();
+    
+    if(data=='C'){
+    autopwm[THR]=minpwm[2];
+    wait(60.0);
+    }
+    
 }
\ No newline at end of file