Successful acro and level mode now! Relying on MPU9250 as base sensor. I'm working continuously on tuning and features :) NEWEST VERSION ON: https://github.com/MaEtUgR/FlyBed (CODE 100% compatible/copyable)
Diff: IMU/IMU_10DOF.cpp
- Revision:
- 7:90f876d47862
- Parent:
- 1:60882db03b0f
- Child:
- 8:609a2ad4c30e
--- a/IMU/IMU_10DOF.cpp Fri Sep 11 10:10:36 2015 +0000 +++ b/IMU/IMU_10DOF.cpp Mon Sep 14 12:49:08 2015 +0000 @@ -4,24 +4,24 @@ { dt = 0; dt_sensors = 0; - time_for_dt = 0; - time_for_dt_sensors = 0; angle = Filter.angle; // initialize array pointer - LocalTimer.start(); + LoopTimer.start(); } void IMU_10DOF::readAngles() { - time_for_dt_sensors = LocalTimer.read(); // start time for measuring sensors + SensorTimer.start(); // start time for measuring sensors mpu.readGyro(); // reading sensor data mpu.readAcc(); - dt_sensors = LocalTimer.read() - time_for_dt_sensors; // stop time for measuring sensors + SensorTimer.stop(); // stop time for measuring sensors + dt_sensors = SensorTimer.read(); + SensorTimer.reset(); // meassure dt since last measurement for the filter - dt = LocalTimer.read() - time_for_dt; // time in s since last loop - time_for_dt = LocalTimer.read(); // set new time for next measurement + dt = LoopTimer.read(); // time in s since last loop + LoopTimer.reset(); Filter.compute(dt, mpu.Gyro, mpu.Acc, mpu.Acc); } \ No newline at end of file