diff --git a/server/src/Controllers/VideoStreamController.cs b/server/src/Controllers/VideoStreamController.cs index 33fce93..4d73f0c 100644 --- a/server/src/Controllers/VideoStreamController.cs +++ b/server/src/Controllers/VideoStreamController.cs @@ -371,6 +371,10 @@ public class VideoStreamController : ControllerBase /// /// 初始化结果 [HttpPost("InitAutoFocus")] + [EnableCors("Users")] + [ProducesResponseType(typeof(object), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(object), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] public async Task InitAutoFocus() { try @@ -412,6 +416,10 @@ public class VideoStreamController : ControllerBase /// /// 对焦结果 [HttpPost("AutoFocus")] + [EnableCors("Users")] + [ProducesResponseType(typeof(object), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(object), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] public async Task AutoFocus() { try diff --git a/server/src/Peripherals/CameraClient.cs b/server/src/Peripherals/CameraClient.cs index 5ab6e61..65b8609 100644 --- a/server/src/Peripherals/CameraClient.cs +++ b/server/src/Peripherals/CameraClient.cs @@ -483,48 +483,48 @@ class Camera /// 配置结果 public async ValueTask> 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; // 初始化完成 } diff --git a/server/src/UdpClientPool.cs b/server/src/UdpClientPool.cs index bd2a3c7..8620c63 100644 --- a/server/src/UdpClientPool.cs +++ b/server/src/UdpClientPool.cs @@ -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; } diff --git a/server/src/UdpServer.cs b/server/src/UdpServer.cs index 1f62f62..a2f0452 100644 --- a/server/src/UdpServer.cs +++ b/server/src/UdpServer.cs @@ -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)