feat: 新增ARP刷新函数,并且在每次clearData后执行一次刷新
This commit is contained in:
@@ -214,7 +214,7 @@ class Camera
|
||||
public async ValueTask<Result<byte[]>> ReadFrame()
|
||||
{
|
||||
// 只在第一次或出错时清除UDP缓冲区,避免每帧都清除造成延迟
|
||||
// await MsgBus.UDPServer.ClearUDPData(this.address, this.taskID);
|
||||
MsgBus.UDPServer.ClearUDPData(this.address, this.taskID);
|
||||
|
||||
logger.Trace($"Reading frame from camera {this.address}");
|
||||
|
||||
@@ -253,7 +253,7 @@ class Camera
|
||||
private async ValueTask<Result<byte>> ReadRegister(UInt16 registerAddr)
|
||||
{
|
||||
var i2c = new Peripherals.I2cClient.I2c(this.address, this.port, this.taskID, this.timeout);
|
||||
|
||||
|
||||
// 地址高低字节
|
||||
var addrBytes = new byte[2];
|
||||
addrBytes[0] = (byte)(registerAddr >> 8);
|
||||
@@ -280,6 +280,8 @@ class Camera
|
||||
/// <returns>配置结果</returns>
|
||||
public async ValueTask<Result<bool>> ConfigureRegisters(UInt16[][] registerTable, int? customDelayMs = null)
|
||||
{
|
||||
MsgBus.UDPServer.ClearUDPData(this.address, this.taskID);
|
||||
|
||||
var i2c = new Peripherals.I2cClient.I2c(this.address, this.port, this.taskID, this.timeout);
|
||||
|
||||
foreach (var cmd in registerTable)
|
||||
@@ -1302,20 +1304,20 @@ class Camera
|
||||
logger.Error($"读取自动对焦初始化状态失败: {readResult.Error}");
|
||||
return new(readResult.Error);
|
||||
}
|
||||
|
||||
|
||||
logger.Trace($"自动对焦初始化状态检查, state=0x{readResult.Value:X2}");
|
||||
|
||||
|
||||
if (readResult.Value == 0x70)
|
||||
{
|
||||
break; // 初始化完成
|
||||
}
|
||||
|
||||
|
||||
if (iteration == 1)
|
||||
{
|
||||
logger.Error($"自动对焦初始化状态检查超时!! state=0x{readResult.Value:X2}");
|
||||
return new(new Exception($"自动对焦初始化状态检查超时, state=0x{readResult.Value:X2}"));
|
||||
}
|
||||
|
||||
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user