fix: 修复示波器修改后无法配置的问题;修复无法生成api的问题;feat: 新增全局控制七段数码管

This commit is contained in:
2025-08-22 02:17:30 +08:00
parent 8fbd30e69f
commit 7d3ef598de
13 changed files with 204 additions and 58 deletions

View File

@@ -141,16 +141,14 @@
<div class="form-control">
<label class="label">
<span class="label-text font-medium">触发电平</span>
<span class="label-text-alt">{{
osc.config.triggerLevel
}}</span>
<span class="label-text-alt">{{ triggerLevel }}</span>
</label>
<input
type="range"
min="0"
max="255"
step="1"
v-model="osc.config.triggerLevel"
v-model="triggerLevel"
class="range range-primary [--range-bg:#2b7fff]"
/>
<div
@@ -181,16 +179,14 @@
<div class="form-control">
<label class="label">
<span class="label-text font-medium">水平偏移</span>
<span class="label-text-alt">{{
osc.config.horizontalShift
}}</span>
<span class="label-text-alt">{{ horizontalShift }}</span>
</label>
<input
type="range"
min="0"
max="1000"
step="1"
v-model="osc.config.horizontalShift"
v-model="horizontalShift"
class="range range-secondary [--range-bg:#c27aff]"
/>
</div>
@@ -198,16 +194,14 @@
<div class="form-control">
<label class="label">
<span class="label-text font-medium">抽取率</span>
<span class="label-text-alt"
>{{ osc.config.decimationRate }}%</span
>
<span class="label-text-alt">{{ decimationRate }}%</span>
</label>
<input
type="range"
min="0"
max="100"
step="1"
v-model="osc.config.decimationRate"
v-model="decimationRate"
class="range range-accent [--range-bg:#fb64b6]"
/>
</div>
@@ -215,16 +209,14 @@
<div class="form-control">
<label class="label">
<span class="label-text font-medium">刷新频率</span>
<span class="label-text-alt"
>{{ osc.config.captureFrequency }}Hz</span
>
<span class="label-text-alt">{{ captureFrequency }}Hz</span>
</label>
<input
type="range"
min="1"
max="1000"
step="1"
v-model="osc.config.captureFrequency"
v-model="captureFrequency"
class="range range-info [--range-bg:#51a2ff]"
/>
</div>
@@ -334,6 +326,7 @@ import { useOscilloscopeState } from "@/components/Oscilloscope/OscilloscopeMana
import { useRequiredInjection } from "@/utils/Common";
import { ref, computed } from "vue";
import { watchEffect } from "vue";
import { toNumber } from "lodash";
// 使用全局设备配置
const equipments = useEquipments();
@@ -341,6 +334,23 @@ const equipments = useEquipments();
// 获取示波器状态和操作
const osc = useRequiredInjection(useOscilloscopeState);
const decimationRate = ref(osc.config.decimationRate);
watchEffect(() => {
osc.config.decimationRate = toNumber(decimationRate.value);
});
const captureFrequency = ref(osc.config.captureFrequency);
watchEffect(() => {
osc.config.captureFrequency = toNumber(captureFrequency.value);
});
const triggerLevel = ref(osc.config.triggerLevel);
watchEffect(() => {
osc.config.triggerLevel = toNumber(triggerLevel.value);
});
const horizontalShift = ref(osc.config.horizontalShift);
watchEffect(() => {
osc.config.horizontalShift = toNumber(horizontalShift.value);
});
// 计算是否有波形数据
const hasWaveformData = computed(() => {
const data = osc.oscData.value;
@@ -358,6 +368,10 @@ function toggleCapture() {
function resetConfiguration() {
osc.resetConfiguration();
horizontalShift.value = osc.config.horizontalShift;
triggerLevel.value = osc.config.triggerLevel;
captureFrequency.value = osc.config.captureFrequency;
decimationRate.value = osc.config.decimationRate;
}
</script>