MPU6000: Use signed addition when accumulating readings.

- Fixes very erratic accel readings on the PX4 board.
This commit is contained in:
James Bielman 2013-01-04 15:43:17 -08:00 committed by Pat Hickey
parent e575c5eba0
commit 1309b7332a
1 changed files with 2 additions and 2 deletions

View File

@ -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++;