STMicroelectronics/STMems_Linux_IIO_drivers

ism330dhcx temperature in wrong format

Paplewski opened this issue · 1 comments

According to the IIO ABI documentation the temperature output units are standardized:

Units after application of scale and offset are milli degrees Celsius.

Applying the following patch solves the problem.

Subject: [PATCH 1/1] Fix temperature scaling issue

According to the iio ABI documentation the units of the temperature
is mili degrees Celsius.
---
 drivers/iio/imu/st_ism330dhcx/st_ism330dhcx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_ism330dhcx/st_ism330dhcx_core.c b/drivers/iio/imu/st_ism330dhcx/st_ism330dhcx_core.c
index 07e8e2d77f5f..9939c65a1e51 100644
--- a/drivers/iio/imu/st_ism330dhcx/st_ism330dhcx_core.c
+++ b/drivers/iio/imu/st_ism330dhcx/st_ism330dhcx_core.c
@@ -781,7 +781,7 @@ static int st_ism330dhcx_read_raw(struct iio_dev *iio_dev,
  case IIO_CHAN_INFO_SCALE:
  switch (ch->type) {
  case IIO_TEMP:
- *val = 1;
+ *val = 1000;
  *val2 = ST_ISM330DHCX_TEMP_GAIN;
  ret = IIO_VAL_FRACTIONAL;
  break;

Edit: Currently the units are degrees C

pls consider update driver are moved on new github repository:
https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio)