test

Dependencies:   BMP280 HCSR04_from_mtmt MPU6050_2 mbed SDFileSystem3

Revision:
2:7663d92d33ce
Parent:
1:e7079f9771d3
diff -r e7079f9771d3 -r 7663d92d33ce main.cpp
--- a/main.cpp	Wed Sep 14 08:25:32 2022 +0000
+++ b/main.cpp	Wed Sep 14 14:31:16 2022 +0000
@@ -40,7 +40,7 @@
 #define LEFT_ROLL 15//-38.0//30
 
 #define LEFT_PITCH 10//-15.0
-#define STRAIGHT_ROLL 0.0//12.0//8.0
+#define STRAIGHT_ROLL 0//12.0//8.0
 #define STRAIGHT_PITCH 3.0
 #define TAKEOFF_THR 0.8
 #define LOOP_THR 0.6
@@ -96,12 +96,12 @@
 
 
 
-#define TRIM1 1480
-#define TRIM2 1500
-#define TRIM3 1150
-#define TRIM4 1500
-#define TRIM5 1300
-#define TRIM6 1500
+#define TRIM1 1590
+#define TRIM2 1579
+#define TRIM3 1177
+#define TRIM4 1392
+#define TRIM5 1176
+#define TRIM6 1560
 #define TRIM_CHECK 0
 
 #define GLIDE_ROLL -12.0
@@ -207,7 +207,7 @@
 OperationMode operation_mode = StartUp;
 BombingMode bombing_mode = Takeoff;
 
-static int16_t autopwm[8] = {1514,1435,1180,1512,1176,1800};//6:1848
+static int16_t autopwm[8] = {1590,1579,1177,1392,1176,1560,1178,1178};//6:1848
 
 //1号機14SG
 
@@ -494,19 +494,19 @@
     trimpwm[4] = g_trim5;
     trimpwm[5] = g_trim6;
     
-    maxpwm[0] = 1768;//trimpwm[0] + 330;
-    maxpwm[1] = 1964;//trimpwm[1] + 330;
-    maxpwm[2] = 1848;//trimpwm[2] + 660;
-    maxpwm[3] = 1825;//trimpwm[3] + 330;
-    maxpwm[4] = 1914;//trimpwm[4] + 660;
-    maxpwm[5] = 1816;//trimpwm[5] + 330;
+    maxpwm[0] = 1920;//trimpwm[0] + 330;1768
+    maxpwm[1] = 1909;//trimpwm[1] + 330;1964
+    maxpwm[2] = 1833;//trimpwm[2] + 660;1848
+    maxpwm[3] = 1722;//trimpwm[3] + 330;1825
+    maxpwm[4] = 1836;//trimpwm[4] + 660;1914
+    maxpwm[5] = 1890;//trimpwm[5] + 330;1816
     
-    minpwm[0]= 1186;//trimpwm[0] - 330;
-    minpwm[1]= 1314;//trimpwm[1] - 330;
+    minpwm[0]= 1260;//trimpwm[0] - 330;1186
+    minpwm[1]= 1249;//trimpwm[1] - 330;1314
     minpwm[2]= trimpwm[2] - 0;
-    minpwm[3]= 1154;//trimpwm[3] - 330;
-    minpwm[4]= 1344;//trimpwm[4] - 0;
-    minpwm[5]= 1144;//trimpwm[5] - 330;
+    minpwm[3]= 1062;//trimpwm[3] - 330;1154
+    minpwm[4]= 1176;//trimpwm[4] - 0;1344
+    minpwm[5]= 846;//trimpwm[5] - 330;1144
 }
 
 void loop()
@@ -740,7 +740,7 @@
                 if(count_op > changeModeCount) {
                     operation_mode = LeftLoop;
                     pc.printf("Goto Left mode\r\n");
-                    pc.attach(NULL, Serial::RxIrq);
+                    pc.attach(getSF_Serial, Serial::RxIrq);
                     count_op = 0;
                 }
             } else count_op = 0;
@@ -1468,7 +1468,7 @@
         if(SFbuf[0]=='S'&&bufcounter<5)bufcounter++;
 
         if(bufcounter==5 && SFbuf[4]=='F') {
-
+            pc.printf("%s\r\n",SFbuf);
             g_landingcommand = SFbuf[1];
             //pc.printf("%c",g_landingcommand);
             wait_ms(10);
@@ -2492,11 +2492,12 @@
     pc.printf("autopwm[ELE]:%d\t\r\n",autopwm[ELE]);
     pc.printf("autpwm[RUD]:%d\t",autopwm[RUD]);*/
     //NVIC_DisableIRQ(EXTI9_5_IRQn);
-    //pc.printf("g_distance:%d\t",g_distance);
+    pc.printf("g_distance:%d\t",g_distance);
     //NVIC_EnableIRQ(EXTI9_5_IRQn);
     /*pc.printf("Mode: %c: ",g_buf[0]);
     if(g_buf[0] == 'Y') pc.printf(" %3.1f",g_SerialTargetYAW);
     pc.printf("%f",g_z_comp);
     pc.printf("\r\n%f,%f\r\n", g_InitBMPHeightAve,g_InitPressAve);*/
-    //pc.printf("\r\n");
+    pc.printf("\r\n");
+    
 }
\ No newline at end of file