mpu6000 driver: set icm registers only on icm devices

This commit is contained in:
JochiPochi 2016-08-17 13:44:38 -04:00 committed by Lorenz Meier
parent e3557e0d3e
commit 31e634b082
1 changed files with 10 additions and 2 deletions

View File

@ -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);