InertialSensor : MPU9250 utilize an explicit type cast to avoid the loss of a fractional part

This commit is contained in:
Pierre Kancir 2016-12-01 17:26:24 +01:00 committed by Lucas De Marchi
parent 13c16e187f
commit de05e6ba29
1 changed files with 2 additions and 2 deletions

View File

@ -438,7 +438,7 @@ bool AP_InertialSensor_MPU9250::_accumulate(uint8_t *samples, uint8_t n_samples)
_fifo_reset();
return false;
}
float temp = t2/340 + 36.53;
float temp = t2/340.0f + 36.53f;
gyro = Vector3f(int16_val(data, 5),
int16_val(data, 4),
@ -527,7 +527,7 @@ bool AP_InertialSensor_MPU9250::_accumulate_fast_sampling(uint8_t *samples, uint
}
if (ret) {
float temp = (tsum/n_samples)/340.0 + 36.53;
float temp = (static_cast<float>(tsum)/n_samples)/340.0f + 36.53f;
_temp_filtered = _temp_filter.apply(temp);
}