diff --git a/src/services/globalCmd/cmdTypes.ts b/src/services/globalCmd/cmdTypes.ts index 4c4158e..9385db3 100644 --- a/src/services/globalCmd/cmdTypes.ts +++ b/src/services/globalCmd/cmdTypes.ts @@ -1,3 +1,4 @@ +import axios from 'axios'; export type OperationCmd = "moveMotorToPosition"; // 移动电机 export type ControlType = { @@ -89,4 +90,8 @@ export type Axis ={ y1: number; x2: number; y2: number; +} + +export type Home = { + axis: 'X' | 'Y' | 'Z' } \ No newline at end of file diff --git a/src/services/globalCmd/globalCmd.ts b/src/services/globalCmd/globalCmd.ts index 1aefa04..c20fb32 100644 --- a/src/services/globalCmd/globalCmd.ts +++ b/src/services/globalCmd/globalCmd.ts @@ -120,3 +120,8 @@ export function turnOffLightPanel(params: Light) { export function turnOnLightPanel(params: {brightness:number}) { return httpRequest>({ url: "/api/cmd/turnOnLightPanel", params:{params}, method: "POST" }); } + +//回原点 +export function motorMoveToHome(params: {axis:string}) { + return httpRequest({ url: "/api/cmd/motorMoveToHome", params:{params}, method: "POST" }); +} diff --git a/src/views/debug/index.vue b/src/views/debug/index.vue index bfdccbc..93044f0 100644 --- a/src/views/debug/index.vue +++ b/src/views/debug/index.vue @@ -52,6 +52,22 @@
+ 电机回原点 + + + X + Y + Z + + + + + 回原点 + + + + + 电机转速 @@ -332,9 +348,10 @@ import { startWash, startDehumidify, stopDehumidify, + motorMoveToHome } from "@/services/globalCmd/globalCmd"; import type { BaseResponse } from "@/services/httpRequest"; -import type { WorkType } from '../../services/globalCmd/cmdTypes'; +import type { WorkType, Home } from '../../services/globalCmd/cmdTypes'; const activeName = ref("debug"); const voltageValue = ref(); const syringeForm = ref({ @@ -553,6 +570,18 @@ function success(data:BaseResponse) { ElMessage.error(data.msg); } } +//回原点 +const initForm = ref({ + axis: 'X' +}) +function onMotorMoveToHome(){ + const params = { + ...initForm.value + } + motorMoveToHome(params).then((res) => { + success(res); + }); +}