Eigen Revision

Dependencies:   mbed LPS25HB_I2C LSM9DS1 PIDcontroller Autopilot_Eigen LoopTicker GPSUBX_UART_Eigen SBUS_without_mainfile MedianFilter Eigen UsaPack solaESKF_Eigen Vector3 CalibrateMagneto FastPWM

Revision:
135:49f8916588da
Parent:
134:d57c6b2a706b
Child:
139:b378528c05f2
--- a/run.cpp	Tue Nov 30 11:27:09 2021 +0000
+++ b/run.cpp	Tue Nov 30 12:04:58 2021 +0000
@@ -103,6 +103,22 @@
                 preflightCheck = false;
                 twelite.serial.printf("PreFlight Check : not home position\r\n");
             }
+            if(sbus.failSafe){
+                preflightCheck = false;
+                twelite.serial.printf("PreFlight Check : no RC\r\n");
+            }
+            // sbusデータの読み込み
+            for (int i =0 ; i < 16;i ++){
+                rc[i] = 0.65f * mapfloat(float(sbus.getData(i)),368,1680,-1,1) + (1.0f - 0.65f) * rc[i]; // mapped input
+            }
+            if (rc[4]>-0.3f && rc[6] < -0.3f){
+                preflightCheck = false;
+                twelite.serial.printf("PreFlight Check : autoPilot enabled\r\n");
+            }
+            if(!(gps.gpsFix == 0x02 || gps.gpsFix == 0x03)){
+                preflightCheck = false;
+                twelite.serial.printf("PreFlight Check : no gps lock\r\n");
+            }
             
             if(preflightCheck == true){
                 break;