Led changed
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_48 by
Diff: main.cpp
- Revision:
- 11:c0b9ad25d3db
- Parent:
- 10:652071c20bf6
- Child:
- 12:763bf416ba4b
diff -r 652071c20bf6 -r c0b9ad25d3db main.cpp --- a/main.cpp Sat Sep 15 15:34:20 2018 +0000 +++ b/main.cpp Sat Sep 15 20:28:15 2018 +0000 @@ -351,7 +351,7 @@ UpdateAutoPWM(controlValue); NVIC_EnableIRQ(USART1_IRQn); NVIC_EnableIRQ(USART2_IRQn); - wait_ms(20); + wait_ms(23); pc.printf("%c",g_landingcommand); #if DEBUG_PRINT_INLOOP DebugPrint(); @@ -922,13 +922,18 @@ static char SFbuf[16]; static int bufcounter=0; - pc.printf("%d",bufcounter); + SFbuf[bufcounter]=pc.getc(); + + + pc.printf("%c",SFbuf[bufcounter]); + if(SFbuf[0]=='S'&&bufcounter<5) bufcounter++; if(bufcounter==5 && SFbuf[4]=='F'){ g_landingcommand = SFbuf[1]; + wait_ms(5); if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]); bufcounter = 0; memset(SFbuf, 0, strlen(SFbuf)); @@ -938,6 +943,7 @@ pc.printf("Communication Falsed.\r\n"); bufcounter = 0; } + } float ConvertByteintoFloat(char high, char low){