You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
pins.i2cReadNumber() will return 0 (without any error) even when the target device (specified with address parameter) is not connected or it have some trouble and cannot answer correctly or any other errors.
We cannot detect the disconnection nor internal error of the devices with current API set.
Describe the solution you'd like
It should indicate the problem about the device with
throw exception
return null
when we cannot read the value from the target i2c device.
Describe alternatives you've considered
If we can detect I2C devices (#1780), we'll detect it and then read/write to the devices. But event when the device is connected and worked correctly for the first time, i2c devices sometimes will stop working with some internal errors (not so rare case). To indicate it, i2cReadNumber() should throw exception or at least should return null or some valued which clearly indicated the error.
Additional context
note: pins have only read/write i2c APIs: i2cReadNumber() and i2cWriteNumber()
Is your feature request related to a problem? Please describe.
pins.i2cReadNumber() will return 0 (without any error) even when the target device (specified with
address
parameter) is not connected or it have some trouble and cannot answer correctly or any other errors.We cannot detect the disconnection nor internal error of the devices with current API set.
Describe the solution you'd like
It should indicate the problem about the device with
null
when we cannot read the value from the target i2c device.
Describe alternatives you've considered
If we can detect I2C devices (#1780), we'll detect it and then read/write to the devices. But event when the device is connected and worked correctly for the first time, i2c devices sometimes will stop working with some internal errors (not so rare case). To indicate it, i2cReadNumber() should throw exception or at least should return null or some valued which clearly indicated the error.
Additional context
note: pins have only read/write i2c APIs: i2cReadNumber() and i2cWriteNumber()
https://makecode.microbit.org/reference/pins
https://makecode.microbit.org/reference/pins/i2c-read-number
https://makecode.microbit.org/reference/pins/i2c-write-number
implementations of them:
https://github.com/microsoft/pxt-microbit/blob/master/libs/core/pins.ts#L21
The text was updated successfully, but these errors were encountered: