fix(uart) should not send uart set command when got config response
This commit is contained in:
parent
545d02e57b
commit
ff3b8bc9c7
|
@ -404,14 +404,6 @@ function updateUartData() {
|
||||||
df.wt_data_flow_attach_cur_to_sender(0);
|
df.wt_data_flow_attach_cur_to_sender(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => store.uartBaud, value => {
|
|
||||||
uart_set_baud(value, uartStore.uartNum);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(() => store.uartConfig, value => {
|
|
||||||
uart_set_config(value, uartStore.uartNum);
|
|
||||||
}, {deep: true});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
registerModule(api.WtModuleID.UART, {
|
registerModule(api.WtModuleID.UART, {
|
||||||
ctrlCallback: onClientCtrl,
|
ctrlCallback: onClientCtrl,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
class="mb-2"
|
class="mb-2"
|
||||||
>
|
>
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<el-select v-model="store.uartBaud" :teleported="false">
|
<el-select v-model="store.uartBaud" :teleported="false" @change="onUartBaudChange">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="overflow-auto max-h-40">
|
<div class="overflow-auto max-h-40">
|
||||||
<div class="flex gap-0">
|
<div class="flex gap-0">
|
||||||
|
@ -51,7 +51,8 @@
|
||||||
<p class="text-xs">实际波特率:{{ store.uartBaudReal }}</p>
|
<p class="text-xs">实际波特率:{{ store.uartBaudReal }}</p>
|
||||||
|
|
||||||
<el-form-item label="数据位" class="mb-2">
|
<el-form-item label="数据位" class="mb-2">
|
||||||
<el-select v-model="store.uartConfig.data_bits" :teleported="false" placeholder="Select">
|
<el-select v-model="store.uartConfig.data_bits" :teleported="false"
|
||||||
|
placeholder="Select" @change="onUartConfigChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in uartDataBitsOptions"
|
v-for="item in uartDataBitsOptions"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
|
@ -62,7 +63,8 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="校验位" class="mb-2">
|
<el-form-item label="校验位" class="mb-2">
|
||||||
<el-select v-model="store.uartConfig.parity" :teleported="false" placeholder="Select">
|
<el-select v-model="store.uartConfig.parity" :teleported="false"
|
||||||
|
placeholder="Select" @change="onUartConfigChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in uartParityOptions"
|
v-for="item in uartParityOptions"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
|
@ -73,7 +75,8 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="停止位">
|
<el-form-item label="停止位">
|
||||||
<el-select v-model="store.uartConfig.stop_bits" :teleported="false" placeholder="Select">
|
<el-select v-model="store.uartConfig.stop_bits" :teleported="false"
|
||||||
|
placeholder="Select" @change="onUartConfigChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in uartStopBitsOptions"
|
v-for="item in uartStopBitsOptions"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
|
@ -343,8 +346,11 @@ import type {MoveEvent} from "sortablejs";
|
||||||
import InlineSvg from "@/components/InlineSvg.vue";
|
import InlineSvg from "@/components/InlineSvg.vue";
|
||||||
import {useDataFlowStore} from "@/stores/useDataFlowStore";
|
import {useDataFlowStore} from "@/stores/useDataFlowStore";
|
||||||
import {wt_data_flow_get_instance_list, type ISocketInfo} from "@/api/apiDataFlow";
|
import {wt_data_flow_get_instance_list, type ISocketInfo} from "@/api/apiDataFlow";
|
||||||
|
import {uart_set_baud, uart_set_config} from "@/api/apiUart";
|
||||||
|
import {useUartStore} from "@/stores/useUartStore";
|
||||||
|
|
||||||
const store = useDataViewerStore()
|
const store = useDataViewerStore()
|
||||||
|
const uartStore = useUartStore()
|
||||||
const wsStore = useWsStore()
|
const wsStore = useWsStore()
|
||||||
const dfStore = useDataFlowStore()
|
const dfStore = useDataFlowStore()
|
||||||
|
|
||||||
|
@ -398,11 +404,20 @@ const uartStopBitsOptions = [
|
||||||
const onUseCustomUartBaud = () => {
|
const onUseCustomUartBaud = () => {
|
||||||
if (uartCustomBaud.value) {
|
if (uartCustomBaud.value) {
|
||||||
store.uartBaud = uartCustomBaud.value;
|
store.uartBaud = uartCustomBaud.value;
|
||||||
|
onUartBaudChange();
|
||||||
} else {
|
} else {
|
||||||
globalNotify("波特率格式错误", "warning")
|
globalNotify("波特率格式错误", "warning")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onUartBaudChange() {
|
||||||
|
uart_set_baud(store.uartBaud, uartStore.uartNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onUartConfigChange() {
|
||||||
|
uart_set_config(store.uartConfig, uartStore.uartNum);
|
||||||
|
}
|
||||||
|
|
||||||
function checkMove(event: MoveEvent) {
|
function checkMove(event: MoveEvent) {
|
||||||
// Find index of related element
|
// Find index of related element
|
||||||
const toIndex: number = Array.from(event.to.children).indexOf(event.related);
|
const toIndex: number = Array.from(event.to.children).indexOf(event.related);
|
||||||
|
|
Loading…
Reference in New Issue