フェイルセーフ完成版

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_53 by 航空研究会

Revision:
14:bbd5ff31fb67
Parent:
13:77b13d5f4d78
Child:
15:43427b0241d9
--- a/main.cpp	Sun Sep 16 07:59:29 2018 +0000
+++ b/main.cpp	Sun Sep 16 11:17:50 2018 +0000
@@ -1017,9 +1017,9 @@
         static char SFbuf[16];
         static int bufcounter=0;
         
-
-        
-        SFbuf[bufcounter]=pc.getc();
+        if(pc.readable()) {    // 受信確認
+            SFbuf[bufcounter] = pc.getc();    // 1文字取り出し
+        }
         
         
         pc.printf("%c",SFbuf[bufcounter]);
@@ -1028,7 +1028,7 @@
             
         if(bufcounter==5 && SFbuf[4]=='F'){
             g_landingcommand = SFbuf[1];
-            wait_ms(5);
+            wait_ms(8);
             if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]);
             bufcounter = 0;
             memset(SFbuf, 0, strlen(SFbuf));