Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_62 by
Diff: main.cpp
- Revision:
- 46:390da0008921
- Parent:
- 45:eebdf6fa7b15
- Child:
- 47:9e11751aa42c
--- a/main.cpp Wed Sep 26 23:43:14 2018 +0000 +++ b/main.cpp Thu Sep 27 01:46:34 2018 +0000 @@ -819,8 +819,8 @@ else{ *g_rightloopRUD_approach = RIGHTLOOPRUD_APPROACH; SDerrorcount++; } - if(GetParameter(fp,paramNames[31],parameter)) *g_leftloopRUD= atof(parameter); - else{ *g_leftloopRUD= LEFTLOOPRUD_APPROACH; + if(GetParameter(fp,paramNames[31],parameter)) *g_leftloopRUD_approach= atof(parameter); + else{ *g_leftloopRUD_approach= LEFTLOOPRUD_APPROACH; SDerrorcount++; } if(GetParameter(fp,paramNames[32],parameter)) *g_rightloopPITCH_approach = atof(parameter); @@ -1141,6 +1141,7 @@ if(bufcounter==5 && SFbuf[4]=='F'){ g_landingcommand = SFbuf[1]; + //pc.printf("%c",g_landingcommand); //wait_ms(20); //if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]); if(g_landingcommand=='Y')g_SerialTargetYAW =0.0f; @@ -1301,7 +1302,7 @@ UpdateTargetAngle_Takeoff(targetAngle); NVIC_DisableIRQ(EXTI9_5_IRQn); - if(g_distance>150) TakeoffCount++; + if(g_distance>100) TakeoffCount++; else TakeoffCount = 0; NVIC_EnableIRQ(EXTI9_5_IRQn); if(TakeoffCount>5){ @@ -1425,6 +1426,8 @@ static bool zeroTHR=true;//着陸時のスロットル動作確認用 + NVIC_DisableIRQ(USART2_IRQn); + if(CheckSW_Up(Ch7)){ output_status = Auto; led1 = 1; @@ -1432,10 +1435,11 @@ output_status = Manual; led1 = 0; zeroTHR=true; + //g_landingcommand='G'; } - NVIC_DisableIRQ(USART2_IRQn); + switch(g_landingcommand){ case 'R': //右旋回セヨ if(zeroTHR==false){ @@ -1484,6 +1488,9 @@ case 'Y': //指定ノヨー方向ニ移動セヨ Rotate(targetAngle, g_SerialTargetYAW); + if(zeroTHR==false){ + autopwm[THR]=minpwm[THR]; + } NVIC_EnableIRQ(USART2_IRQn); break; @@ -1492,9 +1499,10 @@ UpCounter++; if(UpCounter==3){ while(1){ - targetAngle[ROLL] = g_gostraightROLL; + //targetAngle[ROLL] = g_gostraightROLL; autopwm[THR] = minpwm[THR]; autopwm[ELE] = minpwm[ELE]; + autopwm[RUD]=trimpwm[RUD]; if(CheckSW_Up(Ch7)){ output_status = Auto; led1 = 1; @@ -1502,6 +1510,7 @@ output_status = Manual; led1 = 0; zeroTHR=true; + //g_landingcommand='G'; } }