![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
割り込みテスト用
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_27 by
Diff: main.cpp
- Revision:
- 20:9393b0cfa44d
- Parent:
- 19:0955311b0db6
- Child:
- 21:18fe7bf9e187
--- a/main.cpp Mon Sep 17 13:11:53 2018 +0000 +++ b/main.cpp Wed Sep 19 00:05:30 2018 +0000 @@ -1045,7 +1045,7 @@ if(bufcounter==5 && SFbuf[4]=='F'){ g_landingcommand = SFbuf[1]; - wait_ms(8); + wait_ms(80); if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]); bufcounter = 0; memset(SFbuf, 0, strlen(SFbuf)); @@ -1291,11 +1291,12 @@ if(autopwm[AIL_R]>trimpwm[AIL_R]){ //エルロン上がりやすさ調節 autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; } - else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; + else {autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; autopwm[AIL_R]=autopwm[AIL_R]+AIL_R_correctionrightloop; - + } + } break; - } + case 'L': //左旋回セヨ if(zeroTHR==0){ UpdateTargetAngle_Leftloop_zero(targetAngle); @@ -1417,15 +1418,15 @@ //右旋回(着陸時スロットル0の時) void UpdateTargetAngle_Rightloop_zero(float targetAngle[3]){ //右旋回 - + autopwm[THR]=minpwm[THR]; targetAngle[ROLL] = g_rightloopROLL; targetAngle[PITCH] = g_rightloopPITCH ; - autopwm[RUD]=g_rightloopRUD; - autopwm[THR] = minpwm[THR];//SetTHRinRatio(g_loopTHR); - if(autopwm[AIL_R]>trimpwm[AIL_R]){ - autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; - } - else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; + autopwm[RUD]=g_rightloopRUD; //RUD固定 + if(autopwm[AIL_R]>trimpwm[AIL_R]){ //エルロン上がりやすさ調節 + autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; + } + else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; + autopwm[AIL_R]=autopwm[AIL_R]+AIL_R_correctionrightloop; //checkHeight(targetAngle); //pc.printf("Roll = %f, PITCH = %f, THR = %d \r\n", targetAngle[ROLL], targetAngle[PITCH], autopwm[THR]);