From 0d581532ddd16fb3cf68ea948f887f5950a2749b Mon Sep 17 00:00:00 2001 From: mcunator <87765170+mcunator@users.noreply.github.com> Date: Wed, 24 Aug 2022 18:56:35 +0300 Subject: [PATCH] Update bma4.c fix incorrect temperature conversion --- bma4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bma4.c b/bma4.c index 445943f..0634582 100644 --- a/bma4.c +++ b/bma4.c @@ -1631,7 +1631,8 @@ int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *d rslt = bma4_read_regs(BMA4_TEMPERATURE_ADDR, data, BMA4_TEMP_DATA_SIZE, dev); if (rslt == BMA4_OK) { - temp_raw_scaled = (int32_t)data[BMA4_TEMP_BYTE] * BMA4_SCALE_TEMP; + temp_raw_scaled = (int8_t)data[BMA4_TEMP_BYTE]; + temp_raw_scaled *= BMA4_SCALE_TEMP; } /* '0' value read from the register corresponds to 23 degree C */