mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
mpu6000 driver: set icm registers only on icm devices
This commit is contained in:
@@ -744,7 +744,11 @@ int MPU6000::reset()
|
||||
// was 90 Hz, but this ruins quality and does not improve the
|
||||
// system response
|
||||
_set_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
_set_icm_acc_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
|
||||
if (is_icm_device()) {
|
||||
_set_icm_acc_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
}
|
||||
|
||||
usleep(1000);
|
||||
// Gyro scale 2000 deg/s ()
|
||||
write_checked_reg(MPUREG_GYRO_CONFIG, BITS_FS_2000DPS);
|
||||
@@ -1329,7 +1333,11 @@ MPU6000::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||
float cutoff_freq_hz = _accel_filter_x.get_cutoff_freq();
|
||||
float sample_rate = 1.0e6f / ticks;
|
||||
_set_dlpf_filter(cutoff_freq_hz);
|
||||
_set_icm_acc_dlpf_filter(cutoff_freq_hz);
|
||||
|
||||
if (is_icm_device()) {
|
||||
_set_icm_acc_dlpf_filter(cutoff_freq_hz);
|
||||
}
|
||||
|
||||
_accel_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
_accel_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
_accel_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||
|
||||
Reference in New Issue
Block a user