zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.9k stars 6.64k forks source link

BME280 doesn't work correctly with sensor shell #74927

Closed ydamigos closed 4 months ago

ydamigos commented 4 months ago

BME280 doesn't work correctly with sensor shell. Command: sensor get bme280@76 returns Read failed. Command: sensor get bme280@76 channelX enters a loop which always print ambient_temp channel. The issue is a regression of https://github.com/zephyrproject-rtos/zephyr/commit/f9db6ed4147d94060c84ae046ca026a7bf294526

To Reproduce Steps to reproduce the behavior:

  1. west build -b da1469x_dk_pro -p always samples/sensor/sensor_shell
  2. wesh flash

Expected behavior When sending sensor shell commands the following output is expected.

uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76\r\n" ----
sensor get bme280@76
channel type=13(ambient_temp) index=0 shift=7 num_samples=1 value=49962341308ns (29.429999)
channel type=14(press) index=0 shift=7 num_samples=1 value=49962341308ns (101.077752)
channel type=16(humidity) index=0 shift=7 num_samples=1 value=49962341308ns (39.041991)
uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76 ambient_temp\r\n" ----
sensor get bme280@76 ambient_temp
channel type=13(ambient_temp) index=0 shift=5 num_samples=1 value=60172027587ns (29.439999)
uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76 press\r\n" ----
sensor get bme280@76 press
channel type=14(press) index=0 shift=7 num_samples=1 value=68555999755ns (101.071975)
uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76 humidity\r\n" ----
sensor get bme280@76 humidity
channel type=16(humidity) index=0 shift=6 num_samples=1 value=85995056152ns (39.489256)
uart:~$ 

Impact When sending sensor shell commands the following you get the following output:

uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76\r\n" ----
sensor get bme280@76
Read failed
[00:00:36.533,874] <err> BME280: Unsupported channel type 0
uart:~$ 
---- Sent utf8 encoded message: "sensor get bme280@76 humidity\r\n" ----
sensor get bme280@76 humidity
channel type=13(ambient_temp) index=0 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=1 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=2 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=3 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=4 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=5 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=6 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=7 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=8 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=9 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=10 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=11 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=12 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=13 shift=24 num_samples=1 value=48065680365ns (29.789062)
channel type=13(ambient_temp) index=14 shift=24 num_samples=1 value=48065680365ns (29.789062)
..... (continues printing the same line just increasing index)

Environment (please complete the following information):

github-actions[bot] commented 4 months ago

Hi @ydamigos! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙