b7623a85b0
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: Paul Sokolovsky <paul.sokolovsky@linaro.org> |
||
---|---|---|
.. | ||
src | ||
CMakeLists.txt | ||
README.rst | ||
prj.conf | ||
sample.yaml |
README.rst
.. _hts221: HTS221: Temperature and Humidity Monitor ######################################## Overview ******** This sample periodically reads temperature and humidity from the HTS221 Temperature & Humidity Sensor and displays it on the console Requirements ************ This sample uses the HTS221 sensor controlled using the I2C interface. References ********** - HTS211: http://www.st.com/en/mems-and-sensors/hts221.html Building and Running ******************** This project outputs sensor data to the console. It requires an HTS221 sensor, which is present on the disco_l475_iot1 board. .. zephyr-app-commands:: :zephyr-app: samples/sensors/hts221 :board: disco_l475_iot1 :goals: build :compact: Sample Output ============= .. code-block:: console Temperature:25.3 C Relative Humidity:40% Temperature:25.3 C Relative Humidity:40% Temperature:25.3 C Relative Humidity:40% Temperature:25.3 C Relative Humidity:40% <repeats endlessly every 2 seconds>