Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MPU6050_2 SDFileSystem3 HCSR04_2
Diff: main.cpp
- Revision:
- 44:e496af12d20c
- Parent:
- 43:4413ee61bc39
- Child:
- 45:eebdf6fa7b15
diff -r 4413ee61bc39 -r e496af12d20c main.cpp
--- 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': //ブザーヲ鳴ラセ