AP_InertialSensor: allow backend filters to be updated independently from a separate thread
This commit is contained in:
parent
62e3c6a6a9
commit
98f3a4b7d5
@ -781,6 +781,14 @@ void AP_InertialSensor_Backend::update_gyro(uint8_t instance) /* front end */
|
||||
_imu._new_gyro_data[instance] = false;
|
||||
}
|
||||
|
||||
update_gyro_filters(instance);
|
||||
}
|
||||
|
||||
/*
|
||||
propagate filter changes from front end to backend
|
||||
*/
|
||||
void AP_InertialSensor_Backend::update_gyro_filters(uint8_t instance) /* front end */
|
||||
{
|
||||
// possibly update filter frequency
|
||||
const float gyro_rate = _gyro_raw_sample_rate(instance);
|
||||
|
||||
@ -815,7 +823,16 @@ void AP_InertialSensor_Backend::update_accel(uint8_t instance) /* front end */
|
||||
_publish_accel(instance, _imu._accel_filtered[instance]);
|
||||
_imu._new_accel_data[instance] = false;
|
||||
}
|
||||
|
||||
|
||||
update_accel_filters(instance);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
propagate filter changes from front end to backend
|
||||
*/
|
||||
void AP_InertialSensor_Backend::update_accel_filters(uint8_t instance) /* front end */
|
||||
{
|
||||
// possibly update filter frequency
|
||||
if (_last_accel_filter_hz != _accel_filter_cutoff()) {
|
||||
_imu._accel_filter[instance].set_cutoff_frequency(_accel_raw_sample_rate(instance), _accel_filter_cutoff());
|
||||
|
@ -276,9 +276,11 @@ protected:
|
||||
|
||||
// common gyro update function for all backends
|
||||
void update_gyro(uint8_t instance) __RAMFUNC__; /* front end */
|
||||
void update_gyro_filters(uint8_t instance) __RAMFUNC__; /* front end */
|
||||
|
||||
// common accel update function for all backends
|
||||
void update_accel(uint8_t instance) __RAMFUNC__; /* front end */
|
||||
void update_accel_filters(uint8_t instance) __RAMFUNC__; /* front end */
|
||||
|
||||
// support for updating filter at runtime
|
||||
uint16_t _last_accel_filter_hz;
|
||||
|
Loading…
Reference in New Issue
Block a user