mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
invensense/icm42688p: add additional state FIFO_RESET
This state is added to give extra time between FIFO flush command. Some icm42688p IMUs need more time between config -> FIFO reset -> FIFO read. More about the issue #20181
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020-2021 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2020-2022 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -171,21 +171,9 @@ void ICM42688P::RunImpl()
|
|||||||
|
|
||||||
case STATE::CONFIGURE:
|
case STATE::CONFIGURE:
|
||||||
if (Configure()) {
|
if (Configure()) {
|
||||||
// if configure succeeded then start reading from FIFO
|
// if configure succeeded then reset the FIFO
|
||||||
_state = STATE::FIFO_READ;
|
_state = STATE::FIFO_RESET;
|
||||||
|
ScheduleDelayed(1_ms);
|
||||||
if (DataReadyInterruptConfigure()) {
|
|
||||||
_data_ready_interrupt_enabled = true;
|
|
||||||
|
|
||||||
// backup schedule as a watchdog timeout
|
|
||||||
ScheduleDelayed(100_ms);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_data_ready_interrupt_enabled = false;
|
|
||||||
ScheduleOnInterval(_fifo_empty_interval_us, _fifo_empty_interval_us);
|
|
||||||
}
|
|
||||||
|
|
||||||
FIFOReset();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// CONFIGURE not complete
|
// CONFIGURE not complete
|
||||||
@@ -202,6 +190,24 @@ void ICM42688P::RunImpl()
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case STATE::FIFO_RESET:
|
||||||
|
|
||||||
|
_state = STATE::FIFO_READ;
|
||||||
|
FIFOReset();
|
||||||
|
|
||||||
|
if (DataReadyInterruptConfigure()) {
|
||||||
|
_data_ready_interrupt_enabled = true;
|
||||||
|
|
||||||
|
// backup schedule as a watchdog timeout
|
||||||
|
ScheduleDelayed(100_ms);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_data_ready_interrupt_enabled = false;
|
||||||
|
ScheduleOnInterval(_fifo_empty_interval_us, _fifo_empty_interval_us);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE::FIFO_READ: {
|
case STATE::FIFO_READ: {
|
||||||
hrt_abstime timestamp_sample = now;
|
hrt_abstime timestamp_sample = now;
|
||||||
uint8_t samples = 0;
|
uint8_t samples = 0;
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ private:
|
|||||||
RESET,
|
RESET,
|
||||||
WAIT_FOR_RESET,
|
WAIT_FOR_RESET,
|
||||||
CONFIGURE,
|
CONFIGURE,
|
||||||
|
FIFO_RESET,
|
||||||
FIFO_READ,
|
FIFO_READ,
|
||||||
} _state{STATE::RESET};
|
} _state{STATE::RESET};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user