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
Diff: setup.cpp
- Revision:
- 88:be349faa1976
- Parent:
- 87:89bbbcdb667b
- Child:
- 93:b827f78a717a
diff -r 89bbbcdb667b -r be349faa1976 setup.cpp --- a/setup.cpp Wed Oct 20 01:50:52 2021 +0000 +++ b/setup.cpp Thu Oct 21 06:41:03 2021 +0000 @@ -1,7 +1,22 @@ #include "global.hpp" +using namespace std; void setup() { + sd.baud(115200); + sd.printf("\r\nFlight Start\r\n"); + twelite.baud(38400); + twelite.printf("\r\nTelemetory Start\r\n"); + + uint16_t reg = lsm.begin(lsm.G_SCALE_245DPS, lsm.A_SCALE_8G); + //printf("%x\n", reg); + if (!lps.init()){ + twelite.printf("Failed to autodetect pressure sensor!\r\n"); + while (1); + } + lps.enableDefault(); + wait_ms(100); + pitchPID.setSetPoint(0.0); pitchratePID.setSetPoint(0.0); rollPID.setSetPoint(0.0); @@ -25,11 +40,6 @@ servoRight.pulsewidth_us(1500.0); servoLeft.pulsewidth_us(1500.0); servoThrust.pulsewidth_us(1100.0); - - sd.baud(115200); - sd.printf("\r\nFlight Start\r\n"); - twelite.baud(38400); - twelite.printf("\r\nTelemetory Start\r\n"); } void calibrate()