Skip to content
Commit b7623a85 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Carles Cufí
Browse files

sensors: Redefine SENSOR_CHAN_HUMIDITY in percents, not milli-percents.

Based on the discussion in #5693, the reason why humidity was defined
in milli-percent was likely following Linux which defines it as such
in its sensor subsystem:
http://elixir.free-electrons.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio#L263



However, Linux defines temperature in milli-degrees either, but
Zephyr uses degrees (similarly for most other quantities). Typical
sensor resolution/precision for humidity is also on the order of 1%.

One of the existing drivers, th02.c, already returned values in
percents, and few apps showed it without conversion and/or units,
leading to confusing output to user like "54500".

So, switching units to percents, and update all the drivers and
sample apps.

For few drivers, there was also optimized conversion arithmetics
to avoid u64_t operations. (There're probably more places to
optimize it, and temperature conversion could use such optimization
too, but that's left for another patch.)

Fixes: #5693

Signed-off-by: default avatarPaul Sokolovsky <paul.sokolovsky@linaro.org>
parent 2ff98636
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment