jevois完成版 sizeofに変更
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_54 by
Diff: main.cpp
- Revision:
- 44:e496af12d20c
- Parent:
- 43:4413ee61bc39
--- a/main.cpp Wed Sep 26 11:26:28 2018 +0000 +++ b/main.cpp Wed Sep 26 15:45:59 2018 +0000 @@ -1030,7 +1030,7 @@ OKCounter=0; FailsafeCounter=0; } - pc.printf("OKCounter=%d, FailsafeCounter=%d, sbus.failsafe_status=%d\r\n",OKCounter,FailsafeCounter,sbus.failsafe_status); + //pc.printf("OKCounter=%d, FailsafeCounter=%d, sbus.failsafe_status=%d\r\n",OKCounter,FailsafeCounter,sbus.failsafe_status); } //if(sbus.failsafe_status==SBUS_SIGNAL_OK){FailsafeCounter=0;} @@ -1145,14 +1145,14 @@ //if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]); if(g_landingcommand=='Y')g_SerialTargetYAW =0.0f; bufcounter = 0; - memset(SFbuf, 0, strlen(SFbuf)); + memset(SFbuf, 0, sizeof(SFbuf)); NVIC_ClearPendingIRQ(USART2_IRQn); //pc.printf("command = %c, commandYAW = %f\r\n", g_landingcommand, g_SerialTargetYAW); } else if(bufcounter>=5){ //pc.printf("Communication Falsed.\r\n"); - memset(SFbuf, 0, strlen(SFbuf)); + memset(SFbuf, 0, sizeof(SFbuf)); bufcounter = 0; NVIC_ClearPendingIRQ(USART2_IRQn); } @@ -1488,10 +1488,26 @@ break; case 'U': //機首ヲ上ゲヨ - targetAngle[ROLL] = g_gostraightROLL; - autopwm[THR] = minpwm[THR]; - autopwm[ELE] = trimpwm[ELE]-100; - NVIC_EnableIRQ(USART2_IRQn); + static int UpCounter=0; + UpCounter++; + if(UpCounter==3){ + while(1){ + targetAngle[ROLL] = g_gostraightROLL; + autopwm[THR] = minpwm[THR]; + autopwm[ELE] = minpwm[ELE]; + if(CheckSW_Up(Ch7)){ + output_status = Auto; + led1 = 1; + }else{ + output_status = Manual; + led1 = 0; + zeroTHR=true; + } + } + + } + NVIC_EnableIRQ(USART2_IRQn); + break; /*case 'B': //ブザーヲ鳴ラセ