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

This commit is contained in:
Lorenz Meier
2016-12-18 13:06:19 +01:00
parent d7b7799faa
commit f7f47fe6b2
+7 -2
View File
@@ -1696,8 +1696,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)