a

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Files at this revision

API Documentation at this revision

Comitter:
HARUKIDELTA
Date:
Sun Sep 16 06:10:05 2018 +0000
Parent:
11:c0b9ad25d3db
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c0b9ad25d3db -r 763bf416ba4b main.cpp
--- 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");