From f201d4422aa8b6b0a11945932df5d6a40e9d9910 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Tue, 4 Mar 2025 03:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E9=A1=B5=E9=9D=A2=E8=BD=AC?= =?UTF-8?q?=E9=80=9F=E6=8D=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/globalCmd/globalCmd.ts | 5 +++-- src/views/debug/index.vue | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/services/globalCmd/globalCmd.ts b/src/services/globalCmd/globalCmd.ts index 4f2788a..9e26bcc 100644 --- a/src/services/globalCmd/globalCmd.ts +++ b/src/services/globalCmd/globalCmd.ts @@ -22,7 +22,6 @@ export function switchThreeWayValve(params: { type: string }) { }); } - //氮气三路 export function controlValve(params: ControlValueType) { const commandId = addTxnRecord({ ...params, category: "debug" }); @@ -72,6 +71,9 @@ export function pushInTray(params: Record) { export function rotate(params: any) { return httpRequest>({ url: "/api/cmd/rotate", params, method: "POST" }); } +export function setMotorSpeed(params: { axis: "X" | "Y" | "Z"; speed: number }) { + return httpRequest>({ url: "/api/cmd/setMotorSpeed", params: { params }, method: "POST" }); +} export type SprayParam = { matrixId: number; @@ -103,7 +105,6 @@ export function stopDehumidify() { return httpRequest({ url: "/api/cmd/stopDehumidify", method: "POST" }); } - //停止电机 export function stopMotor(params: any) { return httpRequest>({ url: "/api/cmd/stopMotor", params, method: "POST" }); diff --git a/src/views/debug/index.vue b/src/views/debug/index.vue index 1c7751b..db8ec07 100644 --- a/src/views/debug/index.vue +++ b/src/views/debug/index.vue @@ -102,7 +102,7 @@ Z
- 速度:毫米/秒 + 速度:毫米/秒
@@ -295,7 +295,8 @@ import { turnOffLightPanel, turnOnLightPanel, stopWash, - stopDehumidify + stopDehumidify, + setMotorSpeed } from "@/services/globalCmd/globalCmd"; const activeName = ref('debug') const voltageValue = ref() @@ -311,7 +312,7 @@ import { index: 0 }) - const rotateForm = ref>({}) + const rotateForm = ref<{ axis: "X" | "Y" | "Z"; speed: number }>({axis:"X",speed:20}) let subscription:any onMounted(()=>{ //连接websocket @@ -447,11 +448,10 @@ import { const onRotate = () => { const params = { - params : { ...rotateForm.value - } } - rotate(params).then((res:any) => { + + setMotorSpeed(params).then((res:any) => { success(res) }) }