Compare commits
No commits in common. "f710a66c69c1afa5fda756bfdfd941058dca2794" and "8221f8e1335ae5d0518600396f7f6efdbb1fa72c" have entirely different histories.
f710a66c69
...
8221f8e133
|
@ -11,7 +11,6 @@ static class CameraAddr
|
|||
public const UInt32 STORE_NUM = BASE + 0x13;
|
||||
public const UInt32 EXPECTED_VH = BASE + 0x14;
|
||||
public const UInt32 CAPTURE_ON = BASE + 0x15;
|
||||
public const UInt32 CAMERA_POWER = BASE + 0x16; //[0]: rstn, 0 is reset. [8]: power down, 1 is down.
|
||||
}
|
||||
|
||||
class Camera
|
||||
|
@ -27,7 +26,7 @@ class Camera
|
|||
|
||||
const uint CAM_I2C_ADDR = 0x3C;
|
||||
const Peripherals.I2cClient.I2cProtocol CAM_PROTO = Peripherals.I2cClient.I2cProtocol.SCCB;
|
||||
const byte PLL_MUX = 60;
|
||||
const byte PLL_MUX = 10;
|
||||
const UInt32 FrameAddr = 0x00;
|
||||
|
||||
// 动态分辨率参数
|
||||
|
@ -162,56 +161,6 @@ class Camera
|
|||
return true;
|
||||
}
|
||||
|
||||
public async ValueTask<Result<bool>> EnableCameraHardware(bool isEnable)
|
||||
{
|
||||
{
|
||||
var ret = await UDPClientPool.WriteAddr(this.ep, this.taskID, CameraAddr.CAMERA_POWER, (isEnable ? 0x00000001u : 0x00000000u));
|
||||
if (!ret.IsSuccessful)
|
||||
{
|
||||
logger.Error($"Failed to write STORE_ADDR: {ret.Error}");
|
||||
return new(ret.Error);
|
||||
}
|
||||
if (!ret.Value)
|
||||
{
|
||||
logger.Error("STORE_ADDR write returned false");
|
||||
return new(new Exception("STORE_ADDR write returned false"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public async ValueTask<Result<bool>> SleepCameraHardware(bool isEnable)
|
||||
{
|
||||
{
|
||||
var ret = await UDPClientPool.WriteAddr(this.ep, this.taskID, CameraAddr.CAMERA_POWER, (isEnable ? 0x00000101u : 0x00000001u));
|
||||
if (!ret.IsSuccessful)
|
||||
{
|
||||
logger.Error($"Failed to write STORE_ADDR: {ret.Error}");
|
||||
return new(ret.Error);
|
||||
}
|
||||
if (!ret.Value)
|
||||
{
|
||||
logger.Error("STORE_ADDR write returned false");
|
||||
return new(new Exception("STORE_ADDR write returned false"));
|
||||
}
|
||||
}
|
||||
await Task.Delay(5);
|
||||
{
|
||||
var ret = await UDPClientPool.WriteAddr(this.ep, this.taskID, CameraAddr.CAMERA_POWER, 0x00000101);
|
||||
if (!ret.IsSuccessful)
|
||||
{
|
||||
logger.Error($"Failed to write STORE_ADDR: {ret.Error}");
|
||||
return new(ret.Error);
|
||||
}
|
||||
if (!ret.Value)
|
||||
{
|
||||
logger.Error("STORE_ADDR write returned false");
|
||||
return new(new Exception("STORE_ADDR write returned false"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取一帧图像数据
|
||||
/// </summary>
|
||||
|
@ -228,7 +177,7 @@ class Camera
|
|||
this.ep,
|
||||
this.taskID, // taskID
|
||||
FrameAddr,
|
||||
(int)_currentFrameLength, // 使用当前分辨率的动态大小
|
||||
(int)(_currentWidth * _currentHeight * 2), // 使用当前分辨率的动态大小
|
||||
this.timeout);
|
||||
|
||||
if (!result.IsSuccessful)
|
||||
|
@ -301,6 +250,7 @@ class Camera
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ public class HttpVideoStreamService : BackgroundService
|
|||
}
|
||||
_cameraEnable = isEnabled;
|
||||
await _camera.EnableCamera(_cameraEnable);
|
||||
await _camera.SleepCameraHardware(!_cameraEnable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -480,7 +480,6 @@ public class UDPClientPool
|
|||
if (outstanding >= 512 - batchSize)
|
||||
continue;
|
||||
|
||||
|
||||
// Send next batch of address packages (up to 128)
|
||||
int batchSend = Math.Min(batchSize, pkgList.Count - sentCount);
|
||||
var batchPkgs = pkgList.Skip(sentCount).Take(batchSend);
|
||||
|
|
6882
src/APIClient.ts
6882
src/APIClient.ts
File diff suppressed because it is too large
Load Diff
|
@ -340,7 +340,7 @@ import {
|
|||
AlertTriangle,
|
||||
MoreHorizontal,
|
||||
} from "lucide-vue-next";
|
||||
import { VideoStreamClient, CameraConfigRequest, ResolutionConfigRequest } from "@/APIClient";
|
||||
import { VideoStreamClient, CameraConfigRequest } from "@/APIClient";
|
||||
import { useEquipments } from "@/stores/equipments";
|
||||
|
||||
const eqps = useEquipments();
|
||||
|
@ -597,8 +597,7 @@ const refreshResolutions = async () => {
|
|||
try {
|
||||
addLog("info", "正在获取支持的分辨率列表...");
|
||||
const resolutions = await videoClient.getSupportedResolutions();
|
||||
supportedResolutions.value = resolutions.resolutions;
|
||||
console.log("支持的分辨率列表:", supportedResolutions.value);
|
||||
supportedResolutions.value = resolutions;
|
||||
|
||||
// 获取当前分辨率
|
||||
const currentRes = await videoClient.getCurrentResolution();
|
||||
|
@ -630,11 +629,7 @@ const changeResolution = async () => {
|
|||
}
|
||||
|
||||
// 设置新分辨率
|
||||
const resolutionRequest = new ResolutionConfigRequest({
|
||||
width: selectedResolution.value.width,
|
||||
height: selectedResolution.value.height
|
||||
});
|
||||
const success = await videoClient.setResolution(resolutionRequest);
|
||||
const success = await videoClient.setResolution(selectedResolution.value.width, selectedResolution.value.height);
|
||||
|
||||
if (success) {
|
||||
// 刷新流信息
|
||||
|
|
Loading…
Reference in New Issue