Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab
This commit is contained in:
@@ -10,7 +10,12 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
class="btn btn-sm btn-primary"
|
||||
@click="startCapture(true)"
|
||||
@click="
|
||||
() => {
|
||||
handleDeleteData();
|
||||
startCapture();
|
||||
}
|
||||
"
|
||||
:disabled="!captureData"
|
||||
>
|
||||
重新捕获
|
||||
@@ -137,7 +142,7 @@
|
||||
<span>显示</span>
|
||||
<span>颜色</span>
|
||||
<span>触发模式</span>
|
||||
<span>数据位宽(起始:宽度)</span>
|
||||
<span>数据位宽(起始:结尾)</span>
|
||||
<span>父端口编号</span>
|
||||
<span>操作</span>
|
||||
</div>
|
||||
@@ -177,7 +182,7 @@
|
||||
<input
|
||||
v-model="ch.widthStr"
|
||||
class="input input-bordered w-full"
|
||||
placeholder="如0:8"
|
||||
placeholder="如0:7"
|
||||
@change="parseWidthStr(idx)"
|
||||
/>
|
||||
<input
|
||||
@@ -280,7 +285,7 @@ interface DebugChannel {
|
||||
color: string;
|
||||
trigger: CaptureMode;
|
||||
width: number;
|
||||
widthStr: string; // "start:宽度"
|
||||
widthStr: string;
|
||||
start: number;
|
||||
parentPort: number;
|
||||
}
|
||||
@@ -355,7 +360,7 @@ function addChannel() {
|
||||
color: "#00bcd4",
|
||||
trigger: CaptureMode.None,
|
||||
width: 1,
|
||||
widthStr: "0:1",
|
||||
widthStr: "0:0",
|
||||
start: 0,
|
||||
parentPort: 0,
|
||||
});
|
||||
@@ -377,7 +382,7 @@ function stopCapture() {
|
||||
}
|
||||
}
|
||||
|
||||
async function startCapture(isRestart = false) {
|
||||
async function startCapture() {
|
||||
if (!configInited.value) {
|
||||
alert.error("请先配置调试器基本参数");
|
||||
return;
|
||||
@@ -386,34 +391,33 @@ async function startCapture(isRestart = false) {
|
||||
alert.error("请至少添加一个通道");
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验通道参数
|
||||
if (!isRestart) {
|
||||
let usedWires = 0;
|
||||
for (let i = 0; i < channels.value.length; i++) {
|
||||
const ch = channels.value[i];
|
||||
if (!ch.visible) continue;
|
||||
if (!ch.name) {
|
||||
alert.error(`通道 ${i + 1} 名称不能为空`);
|
||||
return;
|
||||
}
|
||||
if (ch.width < 1 || ch.width > 32) {
|
||||
alert.error(`通道 ${i + 1} 数据位宽必须在1到32之间`);
|
||||
return;
|
||||
}
|
||||
if (ch.start < 0 || ch.start + ch.width > 32) {
|
||||
alert.error(`通道 ${i + 1} 起始位+宽度不能超过32`);
|
||||
return;
|
||||
}
|
||||
if (ch.parentPort < 0 || ch.parentPort >= config.totalPortNum) {
|
||||
alert.error(`通道 ${i + 1} 父端口编号超出范围`);
|
||||
return;
|
||||
}
|
||||
usedWires += ch.width;
|
||||
}
|
||||
if (usedWires > config.totalPortNum * 32) {
|
||||
alert.error("所有通道线宽总和不能超过最大线宽数");
|
||||
let usedWires = 0;
|
||||
for (let i = 0; i < channels.value.length; i++) {
|
||||
const ch = channels.value[i];
|
||||
if (!ch.visible) continue;
|
||||
if (!ch.name) {
|
||||
alert.error(`通道 ${i + 1} 名称不能为空`);
|
||||
return;
|
||||
}
|
||||
if (ch.width < 1 || ch.width > 32) {
|
||||
alert.error(`通道 ${i + 1} 数据位宽必须在1到32之间`);
|
||||
return;
|
||||
}
|
||||
if (ch.start < 0 || ch.start + ch.width > 32) {
|
||||
alert.error(`通道 ${i + 1} 起始位+宽度不能超过32`);
|
||||
return;
|
||||
}
|
||||
if (ch.parentPort < 0 || ch.parentPort >= config.totalPortNum) {
|
||||
alert.error(`通道 ${i + 1} 父端口编号超出范围`);
|
||||
return;
|
||||
}
|
||||
usedWires += ch.width;
|
||||
}
|
||||
if (usedWires > config.totalPortNum * 32) {
|
||||
alert.error("所有通道线宽总和不能超过最大线宽数");
|
||||
return;
|
||||
}
|
||||
|
||||
isCapturing.value = true;
|
||||
@@ -444,28 +448,19 @@ async function startCapture(isRestart = false) {
|
||||
|
||||
try {
|
||||
// 设置通道模式
|
||||
if (!isRestart) {
|
||||
let ret = await client.setChannelsMode(apiConfig);
|
||||
if (!ret) {
|
||||
alert.error("设置通道模式失败");
|
||||
isCapturing.value = false;
|
||||
return;
|
||||
}
|
||||
let ret = await client.setChannelsMode(apiConfig);
|
||||
if (!ret) {
|
||||
alert.error("设置通道模式失败");
|
||||
isCapturing.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 启动捕获
|
||||
ret = await client.startTrigger();
|
||||
if (!ret) {
|
||||
alert.error("开始捕获失败,请检查连接");
|
||||
isCapturing.value = false;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
let ret = await client.restartTrigger();
|
||||
if (!ret) {
|
||||
alert.error("重新开始捕获失败,请检查连接");
|
||||
isCapturing.value = false;
|
||||
return;
|
||||
}
|
||||
// 启动捕获
|
||||
ret = await client.startTrigger();
|
||||
if (!ret) {
|
||||
alert.error("开始捕获失败,请检查连接");
|
||||
isCapturing.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 读取数据
|
||||
|
||||
Reference in New Issue
Block a user