MPU6K: Make stop routine safe to call from any location in the startup code

This commit is contained in:
Lorenz Meier 2016-12-18 12:12:42 +01:00
parent 489ee58773
commit fcc85f79d5
1 changed files with 7 additions and 2 deletions

View File

@ -1709,8 +1709,13 @@ MPU6000::stop()
memset(_last_accel, 0, sizeof(_last_accel));
/* discard unread data in the buffers */
_accel_reports->flush();
_gyro_reports->flush();
if (_accel_reports != nullptr) {
_accel_reports->flush();
}
if (_gyro_reports != nullptr) {
_gyro_reports->flush();
}
}
#if defined(USE_I2C)