fix: 修复了之前如修复的i2c问题

This commit is contained in:
SikongJueluo 2025-07-10 21:29:37 +08:00
parent d6167ac286
commit 4a5709a783
2 changed files with 6 additions and 2 deletions

View File

@ -123,7 +123,7 @@ public class I2c
i2cData[i++] = item;
}
var ret = await UDPClientPool.WriteAddr(this.ep, 2, I2cAddr.Write, data);
var ret = await UDPClientPool.WriteAddr(this.ep, 2, I2cAddr.Write, i2cData);
if (!ret.IsSuccessful)
{
logger.Error($"Failed to write data to I2C FIFO: {ret.Error}");

View File

@ -458,7 +458,11 @@ public class UDPClientPool
dataArray[(i * (256 * (32 / 8)))..] :
dataArray[(i * (256 * (32 / 8)))..((i + 1) * (256 * (32 / 8)))];
opts.BurstLength = ((byte)Math.Min(sendDataArray.Length / 4 - 1, 1));
opts.BurstLength = ((byte)(
sendDataArray.Length % 4 == 0 ?
(sendDataArray.Length / 4) :
(sendDataArray.Length / 4) + 1
));
ret = await UDPClientPool.SendAddrPackAsync(endPoint, new SendAddrPackage(opts));
if (!ret) return new(new Exception("Send 1st address package failed!"));