mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 04:13:33 +08:00
Set filter frequency for hardware and software in parallel, always do so in the same order
This commit is contained in:
@@ -910,12 +910,14 @@ MPU6000::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
// adjust filters
|
// adjust filters
|
||||||
float cutoff_freq_hz = _accel_filter_x.get_cutoff_freq();
|
float cutoff_freq_hz = _accel_filter_x.get_cutoff_freq();
|
||||||
float sample_rate = 1.0e6f/ticks;
|
float sample_rate = 1.0e6f/ticks;
|
||||||
|
_set_dlpf_filter(cutoff_freq_hz);
|
||||||
_accel_filter_x.set_cutoff_frequency(sample_rate, 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_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||||
_accel_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
_accel_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz);
|
||||||
|
|
||||||
|
|
||||||
float cutoff_freq_hz_gyro = _gyro_filter_x.get_cutoff_freq();
|
float cutoff_freq_hz_gyro = _gyro_filter_x.get_cutoff_freq();
|
||||||
|
_set_dlpf_filter(cutoff_freq_hz_gyro);
|
||||||
_gyro_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
_gyro_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||||
_gyro_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
_gyro_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||||
_gyro_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
_gyro_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro);
|
||||||
@@ -1051,11 +1053,11 @@ MPU6000::gyro_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
case GYROIOCGLOWPASS:
|
case GYROIOCGLOWPASS:
|
||||||
return _gyro_filter_x.get_cutoff_freq();
|
return _gyro_filter_x.get_cutoff_freq();
|
||||||
case GYROIOCSLOWPASS:
|
case GYROIOCSLOWPASS:
|
||||||
|
// set hardware filtering
|
||||||
|
_set_dlpf_filter(arg);
|
||||||
_gyro_filter_x.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
_gyro_filter_x.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
||||||
_gyro_filter_y.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
_gyro_filter_y.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
||||||
_gyro_filter_z.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
_gyro_filter_z.set_cutoff_frequency(1.0e6f / _call_interval, arg);
|
||||||
// set hardware filtering
|
|
||||||
_set_dlpf_filter(arg);
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
case GYROIOCSSCALE:
|
case GYROIOCSSCALE:
|
||||||
|
|||||||
Reference in New Issue
Block a user