drivers: sensor: scd4x: fix int overflow on val2 for temp and hum
The scd4x_channel_get function converts raw word values to
struct sensor_value's per the datasheet. The calculation for val2 of a
struct sensor_value `val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF;`
can overflow the max of int32_t, resulting in an incorrect
sensor_value.
Fix it by changing the type of tmp_val to int64_t.
Signed-off-by:
Zach Thomas <zach.thomas1.zt@gmail.com>
Loading
Please sign in to comment