mpu9250 Fixed 'test' function causes register checking to find a false faults

Diisabled interrupts in reset to make command to reset atomic.

      Added hold off of testing for register faults from the duration
      of the test.
This commit is contained in:
David Sidrane
2017-04-11 12:41:43 -10:00
committed by Lorenz Meier
parent 15460ade77
commit c3c5be3881
+14
View File
@@ -371,6 +371,12 @@ out:
int MPU9250::reset()
{
irqstate_t state;
// Hold off sampling for 60 ms
state = px4_enter_critical_section();
_reset_wait = hrt_absolute_time() + 60000;
write_reg(MPUREG_PWR_MGMT_1, BIT_H_RESET);
up_udelay(10000);
@@ -380,6 +386,14 @@ int MPU9250::reset()
write_checked_reg(MPUREG_PWR_MGMT_2, 0);
up_udelay(1000);
px4_leave_critical_section(state);
// Hold off sampling for 30 ms
state = px4_enter_critical_section();
_reset_wait = hrt_absolute_time() + 30000;
px4_leave_critical_section(state);
// SAMPLE RATE
_set_sample_rate(_sample_rate);
usleep(1000);