Browse Source

fix: 调试指令增加

master
guoapeng 2 months ago
parent
commit
167d8f3e91
  1. 4
      src/libs/utils.ts
  2. 4
      src/stores/debugStore.ts
  3. 10
      src/types/debug.d.ts
  4. 93
      src/views/debug/index.vue
  5. 2
      src/views/home/index.vue

4
src/libs/utils.ts

@ -58,6 +58,10 @@ export const cmdNameMap = {
debug_show_smog: '展示烟雾',
debug_vacuum_valve_open: '开启真空泵阀门',
debug_vacuum_valve_close: '关闭真空泵阀门',
debug_fill_light_open: '开启补光灯',
debug_fill_light_close: '关闭补光灯',
debug_tri_color_light_open: '开启三色灯',
debug_tri_color_light_close: '关闭三色灯',
}
export const generateColors = (count: number): string[] => {

4
src/stores/debugStore.ts

@ -7,6 +7,10 @@ import { useSystemStore } from 'stores/systemStore'
export const useDebugStore = defineStore('debug', {
state: (): Debug.DebugStore => ({
formData: {
light: {
lightIntensity: 100,
color: 'RED',
},
// 加液机械臂
liquidArmData: {
largeArmAngle: undefined,

10
src/types/debug.d.ts

@ -9,6 +9,10 @@ declare namespace Debug {
heatArea: HeatArea
transferModule: TransferModule
lidData: LidData
light: {
lightIntensity: number
color: 'RED' | 'GREEN' | 'BLUE'
}
}
interface LiquidArmData {
largeArmAngle: number | undefined
@ -53,7 +57,7 @@ declare namespace Debug {
xDimVelocity: number | undefined
times: number | undefined
direction: 'forward' | 'backward'
position: number | undefined
position?: number | undefined
}
interface YMotorData {
@ -61,7 +65,7 @@ declare namespace Debug {
yDimVelocity: number | undefined
times: number | undefined
direction: 'forward' | 'backward'
position: number | undefined
position?: number | undefined
}
interface ZMotorData {
@ -69,7 +73,7 @@ declare namespace Debug {
zDimVelocity: number | undefined
times: number | undefined
direction: 'forward' | 'backward'
position: number | undefined
position?: number | undefined
}
interface JawData {

93
src/views/debug/index.vue

@ -631,6 +631,50 @@ const debug_stop_all_motor = async () => {
}
const savePositionVisible = ref(false)
const debug_fill_light_open = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: currentCommandId,
command: 'debug_fill_light_open',
params: {
...debugStore.formData.light,
},
}
await debugStore.sendControl(params)
}
const debug_fill_light_close = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: currentCommandId,
command: 'debug_fill_light_close',
params: {
},
}
await debugStore.sendControl(params)
}
const debug_tri_color_light_open = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: currentCommandId,
command: 'debug_tri_color_light_open',
params: {
...debugStore.formData.light,
},
}
await debugStore.sendControl(params)
}
const debug_tri_color_light_close = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: currentCommandId,
command: 'debug_tri_color_light_close',
params: {
},
}
await debugStore.sendControl(params)
}
</script>
<template>
@ -1114,6 +1158,55 @@ const savePositionVisible = ref(false)
</el-form>
</div>
</el-card>
<el-card>
<template #header>
<div class="card-header">
<span>灯光</span>
</div>
</template>
<el-divider>补光灯</el-divider>
<div class="card-box">
<el-form>
<el-form-item label="亮度">
<el-slider v-model="debugStore.formData.light.lightIntensity" />
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="debug_fill_light_open">
开启
</ft-button>
<ft-button :click-handle="debug_fill_light_close">
关闭
</ft-button>
</el-form-item>
</el-form>
</div>
<el-divider>三色灯</el-divider>
<div class="card-box">
<el-form>
<el-form-item label="颜色">
<el-radio-group v-model="debugStore.formData.light.color">
<el-radio value="RED">
红色
</el-radio>
<el-radio value="GREEN">
绿色
</el-radio>
<el-radio value="BLUE">
蓝色
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<ft-button type="primary" :click-handle="debug_tri_color_light_open">
开启
</ft-button>
<ft-button :click-handle="debug_tri_color_light_close">
关闭
</ft-button>
</el-form-item>
</el-form>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card>

2
src/views/home/index.vue

@ -312,7 +312,7 @@ const warmUpStart = async () => {
const lightVisible = ref(false)
const photoUrl = ref('')
const photoUrl = ref('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg')
const take_photo = async () => {
const params = {

Loading…
Cancel
Save