mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 05:03:34 +08:00
l3gd20: check DRDY after check_registers() is called
this allows us to recover from an error that disables data ready
This commit is contained in:
@@ -932,17 +932,6 @@ L3GD20::check_registers(void)
|
|||||||
void
|
void
|
||||||
L3GD20::measure()
|
L3GD20::measure()
|
||||||
{
|
{
|
||||||
#if L3GD20_USE_DRDY
|
|
||||||
// if the gyro doesn't have any data ready then re-schedule
|
|
||||||
// for 100 microseconds later. This ensures we don't double
|
|
||||||
// read a value and then miss the next value
|
|
||||||
if (_bus == PX4_SPI_BUS_SENSORS && stm32_gpioread(GPIO_EXTI_GYRO_DRDY) == 0) {
|
|
||||||
perf_count(_reschedules);
|
|
||||||
hrt_call_delay(&_call, 100);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* status register and data as read back from the device */
|
/* status register and data as read back from the device */
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct {
|
struct {
|
||||||
@@ -962,6 +951,18 @@ L3GD20::measure()
|
|||||||
|
|
||||||
check_registers();
|
check_registers();
|
||||||
|
|
||||||
|
#if L3GD20_USE_DRDY
|
||||||
|
// if the gyro doesn't have any data ready then re-schedule
|
||||||
|
// for 100 microseconds later. This ensures we don't double
|
||||||
|
// read a value and then miss the next value
|
||||||
|
if (_bus == PX4_SPI_BUS_SENSORS && stm32_gpioread(GPIO_EXTI_GYRO_DRDY) == 0) {
|
||||||
|
perf_count(_reschedules);
|
||||||
|
hrt_call_delay(&_call, 100);
|
||||||
|
perf_end(_sample_perf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* fetch data from the sensor */
|
/* fetch data from the sensor */
|
||||||
memset(&raw_report, 0, sizeof(raw_report));
|
memset(&raw_report, 0, sizeof(raw_report));
|
||||||
raw_report.cmd = ADDR_OUT_TEMP | DIR_READ | ADDR_INCREMENT;
|
raw_report.cmd = ADDR_OUT_TEMP | DIR_READ | ADDR_INCREMENT;
|
||||||
|
|||||||
Reference in New Issue
Block a user