Showing the changes to interface/src/SerialInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -225,7 +225,10 @@ void SerialInterface::readData(float deltaTime) { · 224 unmodified lines | ||
| 225 | 225 | |
| 226 | 226 | // ask the invensense for raw gyro data |
| 227 | 227 | short accelData[3]; |
| 228 | − mpu_get_accel_reg(accelData, 0); | |
| 228 | + if (mpu_get_accel_reg(accelData, 0)) { | |
| 229 | + _active = false; | |
| 230 | + return; // disconnected | |
| 231 | + } | |
| 229 | 232 | |
| 230 | 233 | const float LSB_TO_METERS_PER_SECOND2 = 1.f / 16384.f * GRAVITY_EARTH; |
| 231 | 234 | // From MPU-9150 register map, with setting on |