fix: 修复udp突发长度错误的问题,以及camera的i2c地址错误的问题
This commit is contained in:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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!"));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user