mirror of https://github.com/ArduPilot/ardupilot
MPU6000: Use signed addition when accumulating readings.
- Fixes very erratic accel readings on the PX4 board.
This commit is contained in:
parent
e575c5eba0
commit
1309b7332a
|
@ -376,7 +376,7 @@ void AP_InertialSensor_MPU6000::_read_data_transaction() {
|
||||||
_spi->transaction(tx, rx, 15);
|
_spi->transaction(tx, rx, 15);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 7; i++) {
|
for (uint8_t i = 0; i < 7; i++) {
|
||||||
_sum[i] += ((rx[2*i+1] << 8) | rx[2*i+2]);
|
_sum[i] += (int16_t)(((uint16_t)rx[2*i+1] << 8) | rx[2*i+2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_count++;
|
_count++;
|
||||||
|
|
Loading…
Reference in New Issue