fix: 修复i2c发送数据包错误的问题

This commit is contained in:
2025-07-10 18:42:33 +08:00
parent 540f5c788d
commit c6c3f1cc41
3 changed files with 15 additions and 4 deletions

View File

@@ -454,13 +454,11 @@ public class UDPClientPool
{
// Sperate Data Array
var isLastData = i == writeTimes - 1;
var sendDataArray =
isLastData ?
var sendDataArray = isLastData ?
dataArray[(i * (256 * (32 / 8)))..] :
dataArray[(i * (256 * (32 / 8)))..((i + 1) * (256 * (32 / 8)))];
// Write Jtag State Register
opts.BurstLength = ((byte)(sendDataArray.Length / 4 - 1));
opts.BurstLength = ((byte)Math.Min(sendDataArray.Length / 4 - 1, 1));
ret = await UDPClientPool.SendAddrPackAsync(endPoint, new SendAddrPackage(opts));
if (!ret) return new(new Exception("Send 1st address package failed!"));