fix: 修复了break问题
This commit is contained in:
		@@ -371,6 +371,10 @@ public class VideoStreamController : ControllerBase
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <returns>初始化结果</returns>
 | 
			
		||||
    [HttpPost("InitAutoFocus")]
 | 
			
		||||
    [EnableCors("Users")]
 | 
			
		||||
    [ProducesResponseType(typeof(object), StatusCodes.Status200OK)]
 | 
			
		||||
    [ProducesResponseType(typeof(object), StatusCodes.Status400BadRequest)]
 | 
			
		||||
    [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
 | 
			
		||||
    public async Task<IResult> InitAutoFocus()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
@@ -412,6 +416,10 @@ public class VideoStreamController : ControllerBase
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <returns>对焦结果</returns>
 | 
			
		||||
    [HttpPost("AutoFocus")]
 | 
			
		||||
    [EnableCors("Users")]
 | 
			
		||||
    [ProducesResponseType(typeof(object), StatusCodes.Status200OK)]
 | 
			
		||||
    [ProducesResponseType(typeof(object), StatusCodes.Status400BadRequest)]
 | 
			
		||||
    [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
 | 
			
		||||
    public async Task<IResult> AutoFocus()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
 
 | 
			
		||||
@@ -483,48 +483,48 @@ class Camera
 | 
			
		||||
    /// <returns>配置结果</returns>
 | 
			
		||||
    public async ValueTask<Result<bool>> ConfigureResolution1280x720()
 | 
			
		||||
    {
 | 
			
		||||
        var Registers = new UInt16[][]
 | 
			
		||||
        {
 | 
			
		||||
            // 1280x720, 15fps
 | 
			
		||||
            // input clock 24Mhz, PCLK 42Mhz
 | 
			
		||||
            // [0x3035, 0x41], // PLL
 | 
			
		||||
            // [0x3036, 0x69], // PLL
 | 
			
		||||
            [0x3c07, 0x07], // lightmeter 1 threshold[7:0]
 | 
			
		||||
            [0x3820, 0x41], // flip
 | 
			
		||||
            [0x3821, 0x07], // mirror
 | 
			
		||||
            [0x3814, 0x31], // timing X inc
 | 
			
		||||
            [0x3815, 0x31], // timing Y inc
 | 
			
		||||
            [0x3800, 0x00], // HS
 | 
			
		||||
            [0x3801, 0x00], // HS
 | 
			
		||||
            [0x3802, 0x00], // VS
 | 
			
		||||
            [0x3803, 0xfa], // VS
 | 
			
		||||
            [0x3804, 0x0a], // HW (HE)
 | 
			
		||||
            [0x3805, 0x3f], // HW (HE)
 | 
			
		||||
            [0x3806, 0x06], // VH (VE)
 | 
			
		||||
            [0x3807, 0xa9], // VH (VE)
 | 
			
		||||
            [0x3808, 0x05], // DVPHO
 | 
			
		||||
            [0x3809, 0x00], // DVPHO
 | 
			
		||||
            [0x380a, 0x02], // DVPVO
 | 
			
		||||
            [0x380b, 0xd0], // DVPVO
 | 
			
		||||
            [0x380c, 0x0B], // HTS
 | 
			
		||||
            [0x380d, 0x1C], // HTS
 | 
			
		||||
            [0x380e, 0x07], // VTS
 | 
			
		||||
            [0x380f, 0xB0], // VTS
 | 
			
		||||
            [0x3810, 0x00], // Timing Hoffset[11:8]
 | 
			
		||||
            [0x3811, 0x10], // Timing Hoffset[7:0]
 | 
			
		||||
            [0x3812, 0x00], // Timing Voffset[10:8]
 | 
			
		||||
            [0x3813, 0x04], // timing V offset
 | 
			
		||||
            [0x3618, 0x00],
 | 
			
		||||
            [0x3612, 0x29],
 | 
			
		||||
            [0x3709, 0x52],
 | 
			
		||||
            [0x370c, 0x03] 
 | 
			
		||||
            // [0x3a02, 0x02], // 60Hz max exposure
 | 
			
		||||
            // [0x3a03, 0xe0], // 60Hz max exposure 
 | 
			
		||||
            // [0x3a14, 0x02], // 50Hz max exposure
 | 
			
		||||
            // [0x3a15, 0xe0]  // 50Hz max exposure
 | 
			
		||||
        };
 | 
			
		||||
        // var Registers = new UInt16[][]
 | 
			
		||||
        // {
 | 
			
		||||
        //     // 1280x720, 15fps
 | 
			
		||||
        //     // input clock 24Mhz, PCLK 42Mhz
 | 
			
		||||
        //     // [0x3035, 0x41], // PLL
 | 
			
		||||
        //     // [0x3036, 0x69], // PLL
 | 
			
		||||
        //     [0x3c07, 0x07], // lightmeter 1 threshold[7:0]
 | 
			
		||||
        //     [0x3820, 0x41], // flip
 | 
			
		||||
        //     [0x3821, 0x07], // mirror
 | 
			
		||||
        //     [0x3814, 0x31], // timing X inc
 | 
			
		||||
        //     [0x3815, 0x31], // timing Y inc
 | 
			
		||||
        //     [0x3800, 0x00], // HS
 | 
			
		||||
        //     [0x3801, 0x00], // HS
 | 
			
		||||
        //     [0x3802, 0x00], // VS
 | 
			
		||||
        //     [0x3803, 0xfa], // VS
 | 
			
		||||
        //     [0x3804, 0x0a], // HW (HE)
 | 
			
		||||
        //     [0x3805, 0x3f], // HW (HE)
 | 
			
		||||
        //     [0x3806, 0x06], // VH (VE)
 | 
			
		||||
        //     [0x3807, 0xa9], // VH (VE)
 | 
			
		||||
        //     [0x3808, 0x05], // DVPHO
 | 
			
		||||
        //     [0x3809, 0x00], // DVPHO
 | 
			
		||||
        //     [0x380a, 0x02], // DVPVO
 | 
			
		||||
        //     [0x380b, 0xd0], // DVPVO
 | 
			
		||||
        //     [0x380c, 0x0B], // HTS
 | 
			
		||||
        //     [0x380d, 0x1C], // HTS
 | 
			
		||||
        //     [0x380e, 0x07], // VTS
 | 
			
		||||
        //     [0x380f, 0xB0], // VTS
 | 
			
		||||
        //     [0x3810, 0x00], // Timing Hoffset[11:8]
 | 
			
		||||
        //     [0x3811, 0x10], // Timing Hoffset[7:0]
 | 
			
		||||
        //     [0x3812, 0x00], // Timing Voffset[10:8]
 | 
			
		||||
        //     [0x3813, 0x04], // timing V offset
 | 
			
		||||
        //     [0x3618, 0x00],
 | 
			
		||||
        //     [0x3612, 0x29],
 | 
			
		||||
        //     [0x3709, 0x52],
 | 
			
		||||
        //     [0x370c, 0x03] 
 | 
			
		||||
        //     // [0x3a02, 0x02], // 60Hz max exposure
 | 
			
		||||
        //     // [0x3a03, 0xe0], // 60Hz max exposure 
 | 
			
		||||
        //     // [0x3a14, 0x02], // 50Hz max exposure
 | 
			
		||||
        //     // [0x3a15, 0xe0]  // 50Hz max exposure
 | 
			
		||||
        // };
 | 
			
		||||
 | 
			
		||||
        await ConfigureRegisters(Registers);
 | 
			
		||||
        // await ConfigureRegisters(Registers);
 | 
			
		||||
 | 
			
		||||
        return await ConfigureResolution(
 | 
			
		||||
            hStart: 0, vStart: 250,
 | 
			
		||||
@@ -1353,7 +1353,7 @@ class Camera
 | 
			
		||||
 | 
			
		||||
            logger.Debug($"自动对焦初始化状态检查, state=0x{readResult.Value:X2}");
 | 
			
		||||
 | 
			
		||||
            if (readResult.Value == 0x70)
 | 
			
		||||
            if (readResult.Value != 0x7F)
 | 
			
		||||
            {
 | 
			
		||||
                break; // 初始化完成
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -91,9 +91,9 @@ public class UDPClientPool
 | 
			
		||||
        var sendLen = socket.SendTo(sendBytes, endPoint);
 | 
			
		||||
        socket.Close();
 | 
			
		||||
 | 
			
		||||
        logger.Debug($"UDP socket send address package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
 | 
			
		||||
        logger.Debug($"  Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
 | 
			
		||||
        logger.Debug($"  Decoded  Data: {pkg.ToString()}");
 | 
			
		||||
        // logger.Debug($"UDP socket send address package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
 | 
			
		||||
        // logger.Debug($"  Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
 | 
			
		||||
        // logger.Debug($"  Decoded  Data: {pkg.ToString()}");
 | 
			
		||||
 | 
			
		||||
        if (sendLen == sendBytes.Length) { return true; }
 | 
			
		||||
        else { return false; }
 | 
			
		||||
@@ -164,8 +164,8 @@ public class UDPClientPool
 | 
			
		||||
        var sendLen = socket.SendTo(sendBytes, endPoint);
 | 
			
		||||
        socket.Close();
 | 
			
		||||
 | 
			
		||||
        logger.Debug($"UDP socket send data package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
 | 
			
		||||
        logger.Debug($"  Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
 | 
			
		||||
        // logger.Debug($"UDP socket send data package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
 | 
			
		||||
        // logger.Debug($"  Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
 | 
			
		||||
 | 
			
		||||
        if (sendLen == sendBytes.Length) { return true; }
 | 
			
		||||
        else { return false; }
 | 
			
		||||
 
 | 
			
		||||
@@ -210,6 +210,7 @@ public class UDPServer
 | 
			
		||||
                        var firstKey = sortedList.Keys[0];
 | 
			
		||||
                        data = sortedList[firstKey];
 | 
			
		||||
                        sortedList.RemoveAt(0);
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -263,6 +264,7 @@ public class UDPServer
 | 
			
		||||
                        // 输出数据
 | 
			
		||||
                        // PrintDataArray(data);
 | 
			
		||||
                        sortedList.Clear();
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
@@ -474,7 +476,7 @@ public class UDPServer
 | 
			
		||||
 | 
			
		||||
                sortedList.Add(uniqueTime, data);
 | 
			
		||||
                // 输出单个数据
 | 
			
		||||
                PrintData(data);
 | 
			
		||||
                // PrintData(data);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (TimeoutException)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user