diff --git a/src/drivers/imu/mpu9250/mpu9250.cpp b/src/drivers/imu/mpu9250/mpu9250.cpp index 0ab770e75b..1e949dac21 100644 --- a/src/drivers/imu/mpu9250/mpu9250.cpp +++ b/src/drivers/imu/mpu9250/mpu9250.cpp @@ -139,11 +139,12 @@ MPU9250::MPU9250(device::Device *interface, device::Device *mag_interface, const _gyro_range_scale(0.0f), _gyro_range_rad_s(0.0f), _dlpf_freq(MPU9250_DEFAULT_ONCHIP_FILTER_FREQ), -#ifdef CRAZYFLIE +// #ifdef CRAZYFLIE +// _sample_rate(250), +// #else +// _sample_rate(1000), +// #endif _sample_rate(250), -#else - _sample_rate(1000), -#endif _accel_reads(perf_alloc(PC_COUNT, "mpu9250_acc_read")), _gyro_reads(perf_alloc(PC_COUNT, "mpu9250_gyro_read")), _sample_perf(perf_alloc(PC_ELAPSED, "mpu9250_read")), @@ -160,8 +161,8 @@ MPU9250::MPU9250(device::Device *interface, device::Device *mag_interface, const _gyro_filter_x(MPU9250_GYRO_DEFAULT_RATE, MPU9250_GYRO_DEFAULT_DRIVER_FILTER_FREQ), _gyro_filter_y(MPU9250_GYRO_DEFAULT_RATE, MPU9250_GYRO_DEFAULT_DRIVER_FILTER_FREQ), _gyro_filter_z(MPU9250_GYRO_DEFAULT_RATE, MPU9250_GYRO_DEFAULT_DRIVER_FILTER_FREQ), - _accel_int(1000000 / MPU9250_ACCEL_MAX_OUTPUT_RATE / 2), - _gyro_int(1000000 / MPU9250_GYRO_MAX_OUTPUT_RATE / 2, true), + _accel_int(1000000 / MPU9250_ACCEL_MAX_OUTPUT_RATE / 4), + _gyro_int(1000000 / MPU9250_GYRO_MAX_OUTPUT_RATE / 4, true), _rotation(rotation), _checked_next(0), _last_temperature(0), @@ -1161,7 +1162,7 @@ MPU9250::cycle() &_work, (worker_t)&MPU9250::cycle_trampoline, this, - USEC2TICK(900)); + USEC2TICK(_call_interval - MPU9250_TIMER_REDUCTION)); } } #endif diff --git a/src/drivers/imu/mpu9250/mpu9250.h b/src/drivers/imu/mpu9250/mpu9250.h index 08f721bd7d..963db6ba21 100644 --- a/src/drivers/imu/mpu9250/mpu9250.h +++ b/src/drivers/imu/mpu9250/mpu9250.h @@ -182,11 +182,11 @@ #define MPU9250_ACCEL_DEFAULT_RATE 1000 // #ifdef CRAZYFLIE -// #define MPU9250_ACCEL_MAX_OUTPUT_RATE 3*280 +// #define MPU9250_ACCEL_MAX_OUTPUT_RATE 4*280 // #else // #define MPU9250_ACCEL_MAX_OUTPUT_RATE 280 // #endif -#define MPU9250_ACCEL_MAX_OUTPUT_RATE 280 +#define MPU9250_ACCEL_MAX_OUTPUT_RATE 280 // remove this when using the previous #ifdef #define MPU9250_ACCEL_DEFAULT_DRIVER_FILTER_FREQ 30 #define MPU9250_GYRO_DEFAULT_RATE 1000 /* rates need to be the same between accel and gyro */