AP_InertialSensor: Allow all filter frequencies to be 16bit.

This commit is contained in:
Andy Piper 2019-05-25 11:59:57 +01:00 committed by Andrew Tridgell
parent fff81a2163
commit 36878e9b3c
3 changed files with 12 additions and 12 deletions

View File

@ -260,7 +260,7 @@ const AP_Param::GroupInfo AP_InertialSensor::var_info[] = {
// @DisplayName: Gyro filter cutoff frequency
// @Description: Filter cutoff frequency for gyroscopes. This can be set to a lower value to try to cope with very high vibration levels in aircraft. This option takes effect on the next reboot. A value of zero means no filtering (not recommended!)
// @Units: Hz
// @Range: 0 127
// @Range: 0 256
// @User: Advanced
AP_GROUPINFO("GYRO_FILTER", 18, AP_InertialSensor, _gyro_filter_cutoff, DEFAULT_GYRO_FILTER),
@ -268,7 +268,7 @@ const AP_Param::GroupInfo AP_InertialSensor::var_info[] = {
// @DisplayName: Accel filter cutoff frequency
// @Description: Filter cutoff frequency for accelerometers. This can be set to a lower value to try to cope with very high vibration levels in aircraft. This option takes effect on the next reboot. A value of zero means no filtering (not recommended!)
// @Units: Hz
// @Range: 0 127
// @Range: 0 256
// @User: Advanced
AP_GROUPINFO("ACCEL_FILTER", 19, AP_InertialSensor, _accel_filter_cutoff, DEFAULT_ACCEL_FILTER),

View File

@ -206,10 +206,10 @@ public:
void set_hil_mode(void) { _hil_mode = true; }
// get the gyro filter rate in Hz
uint8_t get_gyro_filter_hz(void) const { return _gyro_filter_cutoff; }
uint16_t get_gyro_filter_hz(void) const { return _gyro_filter_cutoff; }
// get the accel filter rate in Hz
uint8_t get_accel_filter_hz(void) const { return _accel_filter_cutoff; }
uint16_t get_accel_filter_hz(void) const { return _accel_filter_cutoff; }
// indicate which bit in LOG_BITMASK indicates raw logging enabled
void set_log_raw_bit(uint32_t log_raw_bit) { _log_raw_bit = log_raw_bit; }
@ -466,8 +466,8 @@ private:
float _temperature[INS_MAX_INSTANCES];
// filtering frequency (0 means default)
AP_Int8 _accel_filter_cutoff;
AP_Int8 _gyro_filter_cutoff;
AP_Int16 _accel_filter_cutoff;
AP_Int16 _gyro_filter_cutoff;
AP_Int8 _gyro_cal_timing;
// use for attitude, velocity, position estimates

View File

@ -224,10 +224,10 @@ protected:
int16_t _id = -1;
// return the default filter frequency in Hz for the sample rate
uint8_t _accel_filter_cutoff(void) const { return _imu._accel_filter_cutoff; }
uint16_t _accel_filter_cutoff(void) const { return _imu._accel_filter_cutoff; }
// return the default filter frequency in Hz for the sample rate
uint8_t _gyro_filter_cutoff(void) const { return _imu._gyro_filter_cutoff; }
uint16_t _gyro_filter_cutoff(void) const { return _imu._gyro_filter_cutoff; }
// return the requested sample rate in Hz
uint16_t get_sample_rate_hz(void) const;
@ -236,7 +236,7 @@ protected:
uint16_t _gyro_notch_center_freq_hz(void) const { return _imu._notch_filter.center_freq_hz(); }
// return the notch filter bandwidth in Hz for the sample rate
uint8_t _gyro_notch_bandwidth_hz(void) const { return _imu._notch_filter.bandwidth_hz(); }
uint16_t _gyro_notch_bandwidth_hz(void) const { return _imu._notch_filter.bandwidth_hz(); }
// return the notch filter attenuation in dB for the sample rate
float _gyro_notch_attenuation_dB(void) const { return _imu._notch_filter.attenuation_dB(); }
@ -250,10 +250,10 @@ protected:
void update_accel(uint8_t instance);
// support for updating filter at runtime
uint8_t _last_accel_filter_hz[INS_MAX_INSTANCES];
uint8_t _last_gyro_filter_hz[INS_MAX_INSTANCES];
uint16_t _last_accel_filter_hz[INS_MAX_INSTANCES];
uint16_t _last_gyro_filter_hz[INS_MAX_INSTANCES];
uint16_t _last_notch_center_freq_hz[INS_MAX_INSTANCES];
uint8_t _last_notch_bandwidth_hz[INS_MAX_INSTANCES];
uint16_t _last_notch_bandwidth_hz[INS_MAX_INSTANCES];
float _last_notch_attenuation_dB[INS_MAX_INSTANCES];
void set_gyro_orientation(uint8_t instance, enum Rotation rotation) {