fix: 调整Camera的taskID,使其能够正常接受数据
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user