|
|
|
@ -117,11 +117,13 @@ BMI055_gyro::init()
@@ -117,11 +117,13 @@ BMI055_gyro::init()
|
|
|
|
|
_gyro_reports = new ringbuffer::RingBuffer(2, sizeof(sensor_gyro_s)); |
|
|
|
|
|
|
|
|
|
if (_gyro_reports == nullptr) { |
|
|
|
|
goto out; |
|
|
|
|
return -ENOMEM; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (reset() != OK) { |
|
|
|
|
goto out; |
|
|
|
|
ret = reset(); |
|
|
|
|
|
|
|
|
|
if (ret != OK) { |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Initialize offsets and scales */ |
|
|
|
@ -132,11 +134,14 @@ BMI055_gyro::init()
@@ -132,11 +134,14 @@ BMI055_gyro::init()
|
|
|
|
|
_gyro_scale.z_offset = 0; |
|
|
|
|
_gyro_scale.z_scale = 1.0f; |
|
|
|
|
|
|
|
|
|
param_t gyro_cut_ph = param_find("IMU_GYRO_CUTOFF"); |
|
|
|
|
float gyro_cut = BMI055_GYRO_DEFAULT_DRIVER_FILTER_FREQ; |
|
|
|
|
|
|
|
|
|
/* if probe/setup failed, bail now */ |
|
|
|
|
if (ret != OK) { |
|
|
|
|
DEVICE_DEBUG("gyro init failed"); |
|
|
|
|
return ret; |
|
|
|
|
if (gyro_cut_ph != PARAM_INVALID && (param_get(gyro_cut_ph, &gyro_cut) == PX4_OK)) { |
|
|
|
|
|
|
|
|
|
_gyro_filter_x.set_cutoff_frequency(BMI055_GYRO_DEFAULT_RATE, gyro_cut); |
|
|
|
|
_gyro_filter_y.set_cutoff_frequency(BMI055_GYRO_DEFAULT_RATE, gyro_cut); |
|
|
|
|
_gyro_filter_z.set_cutoff_frequency(BMI055_GYRO_DEFAULT_RATE, gyro_cut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_gyro_class_instance = register_class_devname(GYRO_BASE_DEVICE_PATH); |
|
|
|
@ -154,7 +159,6 @@ BMI055_gyro::init()
@@ -154,7 +159,6 @@ BMI055_gyro::init()
|
|
|
|
|
warnx("ADVERT FAIL"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
out: |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|