feat(stop uart communication)
This commit is contained in:
parent
51783612bc
commit
a7758ac69a
|
@ -403,7 +403,9 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
}
|
||||
|
||||
function addItem(item: Uint8Array, isRX: boolean, doSend: boolean = false, type: number = 0) {
|
||||
|
||||
if (!acceptIncomingData.value && isRX) {
|
||||
return;
|
||||
}
|
||||
const t = new Date();
|
||||
|
||||
// dataArchive.push({
|
||||
|
@ -425,10 +427,14 @@ export const useDataViewerStore = defineStore('text-viewer', () => {
|
|||
newArr.set(computedSuffixValue.value, computedPrefixValue.value.length + item.length);
|
||||
item = newArr;
|
||||
}
|
||||
if (acceptIncomingData.value) {
|
||||
if (doSend) {
|
||||
/* INFO: hard coded for the moment */
|
||||
uart_send_msg(item);
|
||||
}
|
||||
} else {
|
||||
type = 1;
|
||||
}
|
||||
TxTotalByteCount.value += item.length;
|
||||
TxByteCount.value = item.length;
|
||||
}
|
||||
|
|
|
@ -63,16 +63,11 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import {onMounted, onUnmounted, reactive, type Ref, ref, type UnwrapRef, watch} from "vue";
|
||||
import {breakpointsTailwind, useBreakpoints, useWindowSize} from '@vueuse/core'
|
||||
import {breakpointsTailwind, useBreakpoints} from '@vueuse/core'
|
||||
import {useDataViewerStore} from '@/stores/dataViewerStore';
|
||||
import * as api from '@/api';
|
||||
import {ControlEvent} from '@/api';
|
||||
import * as uart from '@/api/apiUart';
|
||||
import * as bin from '@/api/binDataDef';
|
||||
import * as data_flow from '@/api/apiDataFlow';
|
||||
import textDataViewer from "@/views/text-data-viewer/textDataViewer.vue";
|
||||
import textDataConfig from "@/views/text-data-viewer/textDataConfig.vue"
|
||||
import {registerModule} from "@/router/msgRouter";
|
||||
import {type ApiBinaryMsg} from "@/api/binDataDef";
|
||||
import {
|
||||
type IUartMsgBaud,
|
||||
type IUartMsgConfig,
|
||||
|
@ -81,12 +76,17 @@ import {
|
|||
uart_set_baud,
|
||||
uart_set_config,
|
||||
WtUartCmd
|
||||
} from "@/api/apiUart";
|
||||
} from '@/api/apiUart';
|
||||
import {type ApiBinaryMsg} from '@/api/binDataDef';
|
||||
import {wt_data_flow_attach_cur_to_sender} from '@/api/apiDataFlow';
|
||||
import textDataViewer from "@/views/text-data-viewer/textDataViewer.vue";
|
||||
import textDataConfig from "@/views/text-data-viewer/textDataConfig.vue"
|
||||
import {registerModule} from "@/router/msgRouter";
|
||||
import {isDevMode} from "@/composables/buildMode";
|
||||
import {ControlEvent} from "@/api";
|
||||
import {wt_data_flow_attach_cur_to_sender} from "@/api/apiDataFlow";
|
||||
import {useWsStore} from "@/stores/websocket";
|
||||
|
||||
const store = useDataViewerStore()
|
||||
const wsStore = useWsStore()
|
||||
|
||||
const firstWinResizeRef = ref(document.body);
|
||||
const thirdWinResizeRef = ref(document.body);
|
||||
|
@ -94,7 +94,6 @@ const win1Ref = ref(document.body);
|
|||
const win2Ref = ref(document.body);
|
||||
|
||||
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||
const windowSize = useWindowSize()
|
||||
|
||||
const layoutConf = reactive({
|
||||
isSmall: breakpoints.smaller("sm"),
|
||||
|
@ -112,15 +111,6 @@ const layoutOptions = [{
|
|||
|
||||
const layoutMode = ref(layoutOptions[0].value);
|
||||
|
||||
const displayOptions = [{
|
||||
label: '默认显示',
|
||||
value: 'auto'
|
||||
}, {
|
||||
label: '手动显示',
|
||||
value: 'manual'
|
||||
}]
|
||||
const displayMode = ref(displayOptions[0].value);
|
||||
|
||||
interface WinProperty {
|
||||
show: boolean;
|
||||
width: string;
|
||||
|
@ -464,6 +454,7 @@ onMounted(() => {
|
|||
document.addEventListener("mouseup", stopResize, false);
|
||||
document.addEventListener("touchend", stopResize, false);
|
||||
updateUartData();
|
||||
store.acceptIncomingData = wsStore.state === ControlEvent.CONNECTED;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
@ -86,7 +86,9 @@
|
|||
<el-form-item label=" ">
|
||||
<div class="flex">
|
||||
<el-button :type="store.acceptIncomingData ? 'danger': 'success'"
|
||||
:disabled="wsStore.state !== ControlEvent.CONNECTED">
|
||||
:disabled="wsStore.state !== ControlEvent.CONNECTED"
|
||||
@click="store.acceptIncomingData = !store.acceptIncomingData"
|
||||
>
|
||||
{{ store.acceptIncomingData ? "停止数据收发" : "开始数据收发" }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue