フェイルセーフ完成版

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_53 by 航空研究会

Revision:
17:55249ea37dff
Parent:
16:7fca5b938da6
Child:
18:cce82f3374fc
--- a/main.cpp	Mon Sep 17 08:58:08 2018 +0000
+++ b/main.cpp	Mon Sep 17 10:07:27 2018 +0000
@@ -50,16 +50,17 @@
 #define LEFT_ROLL_SHORT 12.0
 #define LEFT_PITCH_SHORT -5.0
 
-#define rightloopRUD 1300  //1250
+/*#define rightloopRUD 1300  //1250
+#define rightloopshortRUD 1250 
+#define leftloopRUD  1500
+#define leftloopshortRUD 1500 
+#define glideloopRUD 1300
+*/
 #define AIL_R_correctionrightloop 0
 #define AIL_L_correctionrightloop -400
-#define rightloopshortRUD 1250 
 #define AIL_L_correctionrightloopshort 0
-#define leftloopRUD  1500
 #define AIL_L_correctionleftloop -0
-#define leftloopshortRUD 1500 
 #define AIL_L_correctionleftloopshort 0
-#define glideloopRUD 1300
 
 #define RIGHTLOOP_RUD 1250 
 #define RIGHTLOOPSHORT_RUD 1250 
@@ -1273,7 +1274,7 @@
             case 'R':   //右旋回セヨ
                 targetAngle[ROLL] = g_rightloopROLL;
         targetAngle[PITCH] = g_rightloopPITCH ;
-        autopwm[RUD]=rightloopRUD;              //RUD固定
+        autopwm[RUD]=g_rightloopRUD;              //RUD固定
         if(autopwm[AIL_R]>trimpwm[AIL_R]){                                                                                  //エルロン上がりやすさ調節
             autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising;
             }
@@ -1285,7 +1286,7 @@
                 case 'L':   //左旋回セヨ
                     targetAngle[ROLL] = g_leftloopROLL;
             targetAngle[PITCH] = g_leftloopPITCH;
-            autopwm[RUD]=leftloopRUD;
+            autopwm[RUD]=g_leftloopRUD;
             if(autopwm[AIL_R]>trimpwm[AIL_R]){
                 autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising;
                 }
@@ -1419,9 +1420,9 @@
     autopwm[RUD]=g_leftloopRUD;
     autopwm[THR] = oldTHR;
     if(autopwm[AIL_R]>trimpwm[AIL_R]){
-        autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising;
+        autopwm[AIL_L]=trimpwm[AIL_L]+g_AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising;
         }
-    else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent;
+    else autopwm[AIL_L]=trimpwm[AIL_L]+g_AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent;
     //checkHeight(targetAngle);
 
     //printf("Roll = %f, PITCH = %f, THR = %d \r\n", targetAngle[], targetAngle[PITCH], autopwm[THR]);