mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_InertialSensor: calculate backend sample rates on ICM45686 correctly
This commit is contained in:
parent
7f32a756bb
commit
3cca401af8
@ -679,20 +679,24 @@ void AP_InertialSensor_Invensensev3::set_filter_and_scaling_icm42670(void)
|
||||
void AP_InertialSensor_Invensensev3::set_filter_and_scaling_icm456xy(void)
|
||||
{
|
||||
uint8_t odr_config = 4;
|
||||
backend_rate_hz = 3200;
|
||||
|
||||
if (enable_fast_sampling(accel_instance) && get_fast_sampling_rate() > 1) {
|
||||
backend_rate_hz = 1600;
|
||||
// always fast sampling
|
||||
fast_sampling = dev->bus_type() == AP_HAL::Device::BUS_TYPE_SPI;
|
||||
|
||||
if (fast_sampling) {
|
||||
if (enable_fast_sampling(accel_instance) && get_fast_sampling_rate() > 1) {
|
||||
backend_rate_hz = calculate_fast_sampling_backend_rate(backend_rate_hz, backend_rate_hz * 4);
|
||||
}
|
||||
}
|
||||
|
||||
// this sensor actually only supports 2 speeds
|
||||
backend_rate_hz = constrain_int16(backend_rate_hz, 3200, 6400);
|
||||
|
||||
switch (backend_rate_hz) {
|
||||
case 6400: // 6.4Khz
|
||||
odr_config = 3;
|
||||
break;
|
||||
case 3200: // 3.2Khz
|
||||
odr_config = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user