bosch/bmi055: fix accel temperature reading

- single register output is in 2's complement
This commit is contained in:
Daniel Agar
2020-08-28 16:01:08 -04:00
committed by GitHub
parent 536877cf0a
commit eb46a42400
@@ -455,7 +455,8 @@ void BMI055_Accelerometer::FIFOReset()
void BMI055_Accelerometer::UpdateTemperature()
{
// The slope of the temperature sensor is 0.5K/LSB, its center temperature is 23°C [(ACC 0x08) temp = 0x00].
float temperature = RegisterRead(Register::ACCD_TEMP) * 0.5f + 23.f;
// The register contains the current chip temperature represented in twos complement format.
float temperature = static_cast<int8_t>(RegisterRead(Register::ACCD_TEMP)) * 0.5f + 23.f;
if (PX4_ISFINITE(temperature)) {
_px4_accel.set_temperature(temperature);