new mpu6000/mpu6500/mpu9250 always schedule backup cycle if using data ready

This commit is contained in:
Daniel Agar
2020-04-06 23:06:06 -04:00
parent 0860a61fa6
commit ff74a2a48b
3 changed files with 12 additions and 3 deletions
@@ -188,10 +188,13 @@ void MPU6000::RunImpl()
case STATE::FIFO_READ: {
hrt_abstime timestamp_sample = 0;
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
if (_data_ready_interrupt_enabled) {
// re-schedule as watchdog timeout
ScheduleDelayed(10_ms);
}
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
// use timestamp from data ready interrupt if enabled and seems valid
timestamp_sample = _fifo_watermark_interrupt_timestamp;
} else {
@@ -188,10 +188,13 @@ void MPU6500::RunImpl()
case STATE::FIFO_READ: {
hrt_abstime timestamp_sample = 0;
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
if (_data_ready_interrupt_enabled) {
// re-schedule as watchdog timeout
ScheduleDelayed(10_ms);
}
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
// use timestamp from data ready interrupt if enabled and seems valid
timestamp_sample = _fifo_watermark_interrupt_timestamp;
} else {
@@ -221,10 +221,13 @@ void MPU9250::RunImpl()
case STATE::FIFO_READ: {
hrt_abstime timestamp_sample = 0;
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
if (_data_ready_interrupt_enabled) {
// re-schedule as watchdog timeout
ScheduleDelayed(10_ms);
}
if (_data_ready_interrupt_enabled && (hrt_elapsed_time(&timestamp_sample) < (_fifo_empty_interval_us / 2))) {
// use timestamp from data ready interrupt if enabled and seems valid
timestamp_sample = _fifo_watermark_interrupt_timestamp;
} else {