From 33a2dbf4379457e1ebab40e0fbb0d48c40077929 Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Fri, 11 Jul 2025 11:54:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dudp=E7=AA=81=E5=8F=91?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8Acamera=E7=9A=84i2c=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/Peripherals/CameraClient.cs | 6 +++--- server/src/UdpClientPool.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/src/Peripherals/CameraClient.cs b/server/src/Peripherals/CameraClient.cs index 546f4e8..0bea403 100644 --- a/server/src/Peripherals/CameraClient.cs +++ b/server/src/Peripherals/CameraClient.cs @@ -23,8 +23,8 @@ class Camera private IPEndPoint ep; - const uint CAM_I2C_ADDR = 0x78; - const Peripherals.I2cClient.I2cProtocol CAM_PROTO = Peripherals.I2cClient.I2cProtocol.I2c; + const uint CAM_I2C_ADDR = 0x3C; + const Peripherals.I2cClient.I2cProtocol CAM_PROTO = Peripherals.I2cClient.I2cProtocol.SCCB; const UInt16 V_CMOS_DISP = 480; const UInt16 H_CMOS_DISP = 640; const UInt16 TOTAL_H_PIXEL = 2570; @@ -357,7 +357,7 @@ class Camera logger.Error($"STORE_NUM write returned false for camera at {this.address}:{this.port}"); return new(new Exception($"STORE_NUM write returned false for camera at {this.address}:{this.port}")); } - } + }78 { var ret = await UDPClientPool.WriteAddr(this.ep, 2, CameraAddr.CAPTURE_ON, 0x01); diff --git a/server/src/UdpClientPool.cs b/server/src/UdpClientPool.cs index bbfeee4..3618134 100644 --- a/server/src/UdpClientPool.cs +++ b/server/src/UdpClientPool.cs @@ -458,11 +458,13 @@ public class UDPClientPool dataArray[(i * (256 * (32 / 8)))..] : dataArray[(i * (256 * (32 / 8)))..((i + 1) * (256 * (32 / 8)))]; + // Calculate BurstLength opts.BurstLength = ((byte)( sendDataArray.Length % 4 == 0 ? - (sendDataArray.Length / 4) : - (sendDataArray.Length / 4) + 1 + (sendDataArray.Length / 4 - 1) : + (sendDataArray.Length / 4) )); + ret = await UDPClientPool.SendAddrPackAsync(endPoint, new SendAddrPackage(opts)); if (!ret) return new(new Exception("Send 1st address package failed!"));