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.32k stars 6.32k forks source link

sensor_shell: strange and unexpected output when getting single axis from 3-axis data #72840

Open ycsin opened 3 months ago

ycsin commented 3 months ago

Describe the bug Getting the data of a single axis from 3-axis data is kinda weird, the following output is from #72833:

uart:~$ sensor get sensor@0 0
channel type=3(accel_xyz) index=0 shift=0 num_samples=0 value=4294967295ns, (-0.000000, -0.000000, -0.000000)
uart:~$ sensor get sensor@0 1
uart:~$ sensor get sensor@0 2
uart:~$ sensor get sensor@0 3
channel type=3(accel_xyz) index=0 shift=2 num_samples=1 value=9220133425350000000ns, (3.000000, 3.000000, 3.000000)
uart:~$ sensor get sensor@0 4
channel type=7(gyro_xyz) index=0 shift=0 num_samples=0 value=4294967295ns, (-0.000000, -0.000000, -0.000000)
uart:~$ sensor get sensor@0 5
uart:~$ sensor get sensor@0 6
uart:~$ sensor get sensor@0 7
channel type=7(gyro_xyz) index=0 shift=3 num_samples=1 value=9220133425350000000ns, (7.000000, 7.000000, 7.000000)

i.e., there's no output for channel(s):

See also #72972

To Reproduce Steps to reproduce the behavior:

  1. Build the sensor_shell sensor with board that has a acc/mag/gyro, or check-out #72833
  2. Use sensor get for the y-axis

What you will see

Expected behavior Use should be able to get any supported channel from the sensor, there should be output when getting a single axis (x, y or z)

Impact sensor get is not able to sample some of the channel(s).

Logs and console output See above

Environment (please complete the following information):

teburd commented 3 months ago

@yperess please take a look when you can

ubieda commented 1 month ago

I believe this issue is not being tackled right now. Would you like me to take a look?

teburd commented 1 month ago

I believe this issue is not being tackled right now. Would you like me to take a look?

Please do if you have the time