フェイルセーフ完成版
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_53 by
Diff: main.cpp
- Revision:
- 41:3b8c250ae79c
- Parent:
- 40:f03b62a3b495
- Child:
- 42:74d72339a8a8
--- a/main.cpp Wed Sep 26 04:02:25 2018 +0000 +++ b/main.cpp Wed Sep 26 04:13:36 2018 +0000 @@ -994,16 +994,17 @@ //pc.printf("%d\r\n",sbus.failsafe_status); if(sbus.failsafe_status==SBUS_SIGNAL_LOST||sbus.failsafe_status==SBUS_SIGNAL_FAILSAFE) FailsafeCounter++; - else FailsafeCounter=0; if(FailsafeCounter>10){ for(uint8_t i=0;i<6;i++) pwm[i] = trimpwm[i]; if(sbus.failsafe_status==SBUS_SIGNAL_OK) OKCounter++; - if(OKCounter>10) { - OKCounter=0; - } - + else OKCounter=0; + + if(OKCounter>5){ + OKCounter=0; + FailsafeCounter=0; + } //pc.printf("%d\r\n",sbus.failsafe_status); //if(sbus.failsafe_status!=SBUS_SIGNAL_FAILSAFE)break; @@ -1459,6 +1460,13 @@ Rotate(targetAngle, g_SerialTargetYAW); NVIC_EnableIRQ(USART2_IRQn); break; + + case 'U': //機首ヲ上ゲヨ + targetAngle[ROLL] = g_gostraightROLL; + autopwm[THR] = minpwm[THR]; + autopwm[ELE] = trimpwm[ELE]-100; + NVIC_EnableIRQ(USART2_IRQn); + break; /*case 'B': //ブザーヲ鳴ラセ //buzzer = 1;