fix: 调整Camera的taskID,使其能够正常接受数据

This commit is contained in:
2025-07-03 19:30:17 +08:00
parent e84a784517
commit 287c416247
2 changed files with 5 additions and 8 deletions

View File

@@ -323,7 +323,6 @@ public class UDPClientPool
opts.BurstType = BurstType.FixedBurst;
opts.CommandID = Convert.ToByte(taskID);
opts.Address = devAddr;
opts.IsWrite = false;
// Check Msg Bus
@@ -332,8 +331,8 @@ public class UDPClientPool
// Calculate read times and segments
var maxBytesPerRead = 256 * (32 / 8); // 1024 bytes per read
var hasRest = dataLength % maxBytesPerRead != 0;
var readTimes = hasRest ?
var restBytes = dataLength % maxBytesPerRead;
var readTimes = restBytes != 0 ?
dataLength / maxBytesPerRead + 1 :
dataLength / maxBytesPerRead;
@@ -341,9 +340,7 @@ public class UDPClientPool
{
// Calculate current segment size
var isLastSegment = i == readTimes - 1;
var currentSegmentSize = isLastSegment && hasRest ?
dataLength % maxBytesPerRead :
maxBytesPerRead;
var currentSegmentSize = isLastSegment ? restBytes : maxBytesPerRead;
// Set burst length (in 32-bit words)
opts.BurstLength = (byte)(currentSegmentSize / 4 - 1);