フェイルセーフ完成版

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_53 by 航空研究会

Revision:
21:18fe7bf9e187
Parent:
20:9393b0cfa44d
Child:
22:438bedf24707
--- a/main.cpp	Wed Sep 19 00:05:30 2018 +0000
+++ b/main.cpp	Wed Sep 19 05:34:41 2018 +0000
@@ -329,14 +329,13 @@
     Init_sbus();    
     Init_sensors();
     //switch2.rise(ResetTrim);
-    pc.attach(getSF_Serial, Serial::RxIrq);
+   
     //USsensor.attach(&UpdateDist, 0.05);
     
     NVIC_SetPriority(USART1_IRQn,0);
     NVIC_SetPriority(EXTI0_IRQn,1);
     NVIC_SetPriority(TIM5_IRQn,2);
     NVIC_SetPriority(EXTI9_5_IRQn,3);
-    NVIC_SetPriority(USART2_IRQn,4);
     DisplayClock();
     t.start();
     
@@ -354,6 +353,9 @@
         led4 = !led4;
     }
     
+     pc.attach(getSF_Serial, Serial::RxIrq);
+     NVIC_SetPriority(USART2_IRQn,4);
+    
     FirstROLL = nowAngle[ROLL];
     FirstPITCH = nowAngle[PITCH];
     nowAngle[ROLL] -=FirstROLL;
@@ -1045,7 +1047,7 @@
             
         if(bufcounter==5 && SFbuf[4]=='F'){
             g_landingcommand = SFbuf[1];
-            wait_ms(80);
+            wait_ms(20);
             if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]);
             bufcounter = 0;
             memset(SFbuf, 0, strlen(SFbuf));