AP_InertialSensor: fixed _dump_registers() for MPU6000

need to take the semaphore to prevent bus errors
This commit is contained in:
Andrew Tridgell 2014-06-29 12:11:21 +10:00
parent 068febda1f
commit ece01da10e

View File

@ -575,6 +575,7 @@ bool AP_InertialSensor_MPU6000::_sample_available()
void AP_InertialSensor_MPU6000::_dump_registers(void)
{
hal.console->println_P(PSTR("MPU6000 registers"));
if (_spi_sem->take(100)) {
for (uint8_t reg=MPUREG_PRODUCT_ID; reg<=108; reg++) {
uint8_t v = _register_read(reg);
hal.console->printf_P(PSTR("%02x:%02x "), (unsigned)reg, (unsigned)v);
@ -583,6 +584,8 @@ void AP_InertialSensor_MPU6000::_dump_registers(void)
}
}
hal.console->println();
_spi_sem->give();
}
}
#endif