GrovePi device binding fails to read sensor values #2337
Labels
bug
Something isn't working
Priority:2
Work that is important, but not critical for the release
Status: In PR
Describe the bug
When using the
DigitalRead
andAnalogRead
functions included in the device binding for GrovePi to read sensor values, the functions return-1
instead of the sensor output, making it impossible to read sensor values.Using the Python library provided by the device manufacturer, correct values can be read.
When reproducing the issue using
AnalogRead
, the binary data obtained fromI2CDevice.Read
is23 255 255
, and in the Python binding,23
is declared asdata_not_available_cmd
which triggers a retry condition.In dotnet, by modifying the code to perform a retry when the first byte of the response is
23
, correct sensor values can be read.If this issue and the proposed fix are deemed appropriate, I would like to submit a PR.
Steps to reproduce
Expected behavior
The AnalogRead function should return the sensor values. internal
I2CDevice.Read
function should return responses like3 3 255
(indicating maximum voltage level) or3 0 0
(indicating minimum voltage level).Actual behavior
The AnalogRead function returns -1. The internal
I2CDevice.Read
function returns a response of23 255 255
.Versions used
Compiled and executed on dotnet8 running on a Raspberry Pi 4. The GrovePi board firmware used is the latest version 1.4.
The library version used
System.Device.Gpio
3.2.0 andIot.Device.Bindings
3.2.0 though other major releases were also tested with the same result.The text was updated successfully, but these errors were encountered: