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: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_36 by
Diff: main.cpp
- Revision:
- 12:763bf416ba4b
- Parent:
- 11:c0b9ad25d3db
- Child:
- 13:77b13d5f4d78
--- a/main.cpp Sat Sep 15 20:28:15 2018 +0000
+++ b/main.cpp Sun Sep 16 06:10:05 2018 +0000
@@ -223,7 +223,8 @@
float *g_takeoffTHR, float *g_loopTHR,
float *g_rightloopROLLshort, float *g_rightloopPITCHshort,
float *g_leftloopROLLshort, float *g_leftloopPITCHshort,
- float *g_glideloopROLL, float *g_glideloopPITCH);
+ float *g_glideloopROLL, float *g_glideloopPITCH,
+ float *g_kpAIL, float *g_kiAIL, float *g_kdAIL);
//switch2割り込み
void ResetTrim();
@@ -291,7 +292,8 @@
&g_takeoffTHR, &g_loopTHR,
&g_rightloopROLLshort, &g_rightloopPITCHshort,
&g_leftloopROLLshort, &g_leftloopPITCHshort,
- &g_glideloopROLL, &g_glideloopPITCH);
+ &g_glideloopROLL, &g_glideloopPITCH,
+ &g_kpAIL, &g_kiAIL,&g_kdAIL);
Init_PWM();
@@ -588,7 +590,8 @@
float *g_takeoffTHR, float *g_loopTHR,
float *g_rightloopROLLshort, float *g_rightloopPITCHshort,
float *g_leftloopROLLshort, float *g_leftloopPITCHshort,
- float *g_glideloopROLL, float *g_glideloopPITCH
+ float *g_glideloopROLL, float *g_glideloopPITCH,
+ float *g_kpAIL, float *g_kiAIL, float *g_kdAIL
){
pc.printf("SDsetup start.\r\n");
@@ -616,7 +619,10 @@
"LEFTLOOP_ROLL_SHORT",
"LEFTLOOP_PITCH_SHORT",
"AUTOGLIDE_ROLL",
- "AUTOGLIDE PITCH"
+ "AUTOGLIDE PITCH",
+ "KP_AILERON",
+ "KI_AILERON",
+ "KD_AILERON"
};
fp = fopen("/sd/option.txt","r");
@@ -703,6 +709,18 @@
else{ *g_glideloopPITCH = GLIDE_PITCH;
SDerrorcount++;
}
+ if(GetParameter(fp,paramNames[20],parameter)) *g_kpAIL = atof(parameter);
+ else{ *g_kpAIL = KP_AIL;
+ SDerrorcount++;
+ }
+ if(GetParameter(fp,paramNames[21],parameter)) *g_kiAIL = atof(parameter);
+ else{ *g_kiAIL = KI_AIL;
+ SDerrorcount++;
+ }
+ if(GetParameter(fp,paramNames[22],parameter)) *g_kdAIL = atof(parameter);
+ else{ *g_kdAIL = KP_AIL;
+ SDerrorcount++;
+ }
fclose(fp);
}else{ //ファイルがなかったら
@@ -721,6 +739,10 @@
*g_gostraightPITCH = STRAIGHT_PITCH;
*g_takeoffTHR = TAKEOFF_THR;
*g_loopTHR = LOOP_THR;
+ *g_kpAIL = KP_AIL; //パラメータ変えるのお忘れなく!!
+ *g_kiAIL = KI_AIL;
+ *g_kdAIL = KD_AIL;
+
SDerrorcount = -1;
}
pc.printf("SDsetup finished.\r\n");
