Browse Source

调试页面添加回原点

master
LiLongLong 5 months ago
parent
commit
3ced65b777
  1. 5
      src/services/globalCmd/cmdTypes.ts
  2. 5
      src/services/globalCmd/globalCmd.ts
  3. 31
      src/views/debug/index.vue

5
src/services/globalCmd/cmdTypes.ts

@ -1,3 +1,4 @@
import axios from 'axios';
export type OperationCmd = "moveMotorToPosition"; // 移动电机 export type OperationCmd = "moveMotorToPosition"; // 移动电机
export type ControlType = { export type ControlType = {
@ -90,3 +91,7 @@ export type Axis ={
x2: number; x2: number;
y2: number; y2: number;
} }
export type Home = {
axis: 'X' | 'Y' | 'Z'
}

5
src/services/globalCmd/globalCmd.ts

@ -120,3 +120,8 @@ export function turnOffLightPanel(params: Light) {
export function turnOnLightPanel(params: {brightness:number}) { export function turnOnLightPanel(params: {brightness:number}) {
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/turnOnLightPanel", params:{params}, method: "POST" }); return httpRequest<BaseResponse<string>>({ url: "/api/cmd/turnOnLightPanel", params:{params}, method: "POST" });
} }
//回原点
export function motorMoveToHome(params: {axis:string}) {
return httpRequest<BaseResponse>({ url: "/api/cmd/motorMoveToHome", params:{params}, method: "POST" });
}

31
src/views/debug/index.vue

@ -52,6 +52,22 @@
<div class="debug_left"> <div class="debug_left">
<div class=""> <div class="">
<el-row> <el-row>
<el-col :span="6" >电机回原点</el-col>
<el-col :span="14">
<el-radio-group v-model="initForm.axis">
<el-radio value="X">X</el-radio>
<el-radio value="Y">Y</el-radio>
<el-radio value="Z">Z</el-radio>
</el-radio-group>
</el-col>
<el-col :span="2">
<el-button type="primary" @click="onMotorMoveToHome">回原点</el-button>
</el-col>
</el-row>
<el-divider />
<el-row>
<el-col :span="6" >电机转速</el-col> <el-col :span="6" >电机转速</el-col>
<el-col :span="14"> <el-col :span="14">
<el-radio-group v-model="rotateForm.axis"> <el-radio-group v-model="rotateForm.axis">
@ -332,9 +348,10 @@ import {
startWash, startWash,
startDehumidify, startDehumidify,
stopDehumidify, stopDehumidify,
motorMoveToHome
} from "@/services/globalCmd/globalCmd"; } from "@/services/globalCmd/globalCmd";
import type { BaseResponse } from "@/services/httpRequest"; 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 activeName = ref("debug");
const voltageValue = ref(); const voltageValue = ref();
const syringeForm = ref<SyringeParams>({ const syringeForm = ref<SyringeParams>({
@ -553,6 +570,18 @@ function success(data:BaseResponse) {
ElMessage.error(data.msg); ElMessage.error(data.msg);
} }
} }
//
const initForm = ref<Home>({
axis: 'X'
})
function onMotorMoveToHome(){
const params = <Home>{
...initForm.value
}
motorMoveToHome(params).then((res) => {
success(res);
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
div { div {

Loading…
Cancel
Save