fix: 修复了之前如修复的i2c问题
This commit is contained in:
		@@ -123,7 +123,7 @@ public class I2c
 | 
			
		||||
                i2cData[i++] = item;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var ret = await UDPClientPool.WriteAddr(this.ep, 2, I2cAddr.Write, data);
 | 
			
		||||
            var ret = await UDPClientPool.WriteAddr(this.ep, 2, I2cAddr.Write, i2cData);
 | 
			
		||||
            if (!ret.IsSuccessful)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Error($"Failed to write data to I2C FIFO: {ret.Error}");
 | 
			
		||||
 
 | 
			
		||||
@@ -458,7 +458,11 @@ public class UDPClientPool
 | 
			
		||||
                dataArray[(i * (256 * (32 / 8)))..] :
 | 
			
		||||
                dataArray[(i * (256 * (32 / 8)))..((i + 1) * (256 * (32 / 8)))];
 | 
			
		||||
 | 
			
		||||
            opts.BurstLength = ((byte)Math.Min(sendDataArray.Length / 4 - 1, 1));
 | 
			
		||||
            opts.BurstLength = ((byte)(
 | 
			
		||||
                sendDataArray.Length % 4 == 0 ?
 | 
			
		||||
                (sendDataArray.Length / 4) :
 | 
			
		||||
                (sendDataArray.Length / 4) + 1
 | 
			
		||||
            ));
 | 
			
		||||
            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