mpu9250: fix mag publishing garbage on IMU failure (SPI only)

The Pixhawk cube as an internal mag on SPI. If there was a bad register
read (e.g. on an IMU failure), _register_wait was non-zero and there was
no transfer but _mag still published mpu_report.mag.
This commit is contained in:
Beat Küng 2019-04-26 17:26:54 +02:00 committed by Lorenz Meier
parent 33fe69a3e8
commit c3ac1497c0
1 changed files with 3 additions and 1 deletions

View File

@ -1058,7 +1058,9 @@ MPU9250::measure()
if (_mag->is_passthrough()) {
# endif
_mag->_measure(mpu_report.mag);
if (_register_wait == 0) {
_mag->_measure(mpu_report.mag);
}
# ifdef USE_I2C