feat: 完善I2C读的逻辑
This commit is contained in:
@@ -201,7 +201,7 @@ public class I2c
|
||||
/// <returns>操作结果,成功返回读取到的数据,否则返回异常信息</returns>
|
||||
public async ValueTask<Result<byte[]>> ReadData(UInt32 devAddr, byte[] data, int dataReadLength, I2cProtocol proto)
|
||||
{
|
||||
if (dataReadLength <= 0 || dataReadLength > 0x0000_FFFF)
|
||||
if (dataReadLength < 1 || dataReadLength > 0x0000_FFFF)
|
||||
{
|
||||
logger.Error($"Read length {dataReadLength} is invalid or exceeds maximum allowed 0x0000_FFFF");
|
||||
return new(new ArgumentException($"Read length {dataReadLength} is invalid or exceeds maximum allowed 0x0000_FFFF"));
|
||||
|
||||
Reference in New Issue
Block a user