pc,attachの変更

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_36 by 航空研究会

Revision:
23:4928a6fd9eee
Parent:
22:438bedf24707
Child:
24:2cc7a3a10e72
--- a/main.cpp	Wed Sep 19 06:37:31 2018 +0000
+++ b/main.cpp	Thu Sep 20 06:02:21 2018 +0000
@@ -169,7 +169,7 @@
 
 int16_t g_AIL_L_Ratio_rightloop = 0.5;
 
-int zeroTHR=1;//着陸時のスロットルが0かの判断用
+bool zeroTHR=true;//着陸時のスロットルが0かの判断用
 
 
 static float nowAngle[3] = {0,0,0};
@@ -288,13 +288,13 @@
         loop();
         
         
-        NVIC_DisableIRQ(USART1_IRQn);
+        //NVIC_DisableIRQ(USART1_IRQn);
         if(!CheckSW_Up(Ch7)){
             led3=0;
         }else{
             led3=1;
         }
-        NVIC_EnableIRQ(USART1_IRQn);
+        //NVIC_EnableIRQ(USART1_IRQn);
     }
     
 }
@@ -581,7 +581,7 @@
     }else{
         output_status = Manual;
         led1 = 0;
-        zeroTHR=1;
+        zeroTHR=true;
     }
 }
 
@@ -890,11 +890,13 @@
 }
 
 bool CheckSW_Up(Channel ch){
+    NVIC_DisableIRQ(USART1_IRQn);
     if(SWITCH_CHECK < sbus.manualpwm[ch]){
         return true;
     }else{
         return false;
     }
+    NVIC_EnableIRQ(USART1_IRQn);
 }
 
 int16_t ThresholdMaxMin(int16_t value, int16_t max, int16_t min){
@@ -1284,7 +1286,7 @@
        
         switch(g_landingcommand){
             case 'R':   //右旋回セヨ
-            if(zeroTHR==0){
+            if(zeroTHR==false){
                 UpdateTargetAngle_Rightloop_zero(targetAngle);
                 }
                 else{
@@ -1301,7 +1303,7 @@
                 break;
                 
                 case 'L':   //左旋回セヨ
-                if(zeroTHR==0){
+                if(zeroTHR==false){
                     UpdateTargetAngle_Leftloop_zero(targetAngle);
                     }
                     else{
@@ -1316,7 +1318,7 @@
                     break;
                     
                 case 'G':   //直進セヨ
-                if(zeroTHR==0){
+                if(zeroTHR==false){
                     UpdateTargetAngle_GoStraight_zero(targetAngle);
                     }
                     else{
@@ -1342,7 +1344,7 @@
                     targetAngle[ROLL] = 0.0;
                     targetAngle[PITCH] = -3.0;
                     autopwm[THR] = minpwm[THR];
-                    zeroTHR=0;
+                    zeroTHR=false;
                     break;
             
             }