init commit

This commit is contained in:
叶志超
2023-10-13 16:43:53 +08:00
parent c1fc36b44c
commit d184776cb3
275 changed files with 8305 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<template>
<n-space vertical justify="center" class="sound-detect-module-config-view">
<div>
<n-select
placeholder="请设置声音检测模块事件"
v-model:value="value"
:options="options"
@update:value="onSelectUpdate"
class="mx-auto"
style="width: 50%; "/>
</div>
<ResetButtonView />
</n-space>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { NSpace, NSelect, useMessage } from 'naive-ui'
import ResetButtonView from '../ResetButtonView.vue'
import { options } from './data'
import { useSerialPortStore } from '@/stores/serialPort'
const message = useMessage()
const serialPort = useSerialPortStore()
const value = ref(null)
const onSelectUpdate = () => {
if (!serialPort.isOpen) {
message.error('请先连接无线通信模块并打开串口')
return
}
let cmd = `$SDEVENT,${value.value}*`
cmd += cmd.length
cmd += '\r\n'
serialPort.write(cmd)
}
</script>
<style scoped lang="less">
.sound-detect-module-config-view {
row-gap: 48px !important;
}
</style>