From 5637142e017693d8b0878cb0111552f9f46cf417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Wed, 28 May 2025 11:06:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add:=E4=BF=AE=E6=94=B9=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iflytop/sgs/hardware/type/IO/InputIOMId.java | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java b/src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java index e0fbf6b..bcc9259 100644 --- a/src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java +++ b/src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java @@ -4,28 +4,28 @@ import com.iflytop.sgs.hardware.type.MId; public enum InputIOMId { E_STOP("E_STOP [ 急停 ]", MId.IO1_IO, 0, false), - Heater_CAP1_EXIST("Heater_CAP1_EXIST [ 加热模块拍子1到位 ]", MId.IO1_IO, 1, false), - Heater_CAP2_EXIST("Heater_CAP2_EXIST [ 加热模块拍子2到位 ]", MId.IO1_IO, 2, false), - Heater_CAP3_EXIST("Heater_CAP3_EXIST [ 加热模块拍子3到位 ]", MId.IO1_IO, 3, false), - Heater_CAP4_EXIST("Heater_CAP4_EXIST [ 加热模块拍子4到位 ]", MId.IO1_IO, 4, false), - WASTE_LIQUID_BARREL_EXIST("WASTE_LIQUID_BARREL_EXIST [ 废液桶存在 ]", MId.IO1_IO, 5, false), - LIQUID_TRAY_EXIST("CLAW_TRAY_EXIST [ 加液位托盘存在 ]", MId.IO1_IO, 6, false), - DILUTE_NITRIC_ACID_LOW_LEVEL("DILUTE_NITRIC_ACID_LOW_LEVEL [ 稀硝酸低液位检测 ]", MId.IO1_IO, 7, false), - CONCENTRATED_NITRIC_ACID_LOW_LEVEL("CONCENTRATED_NITRIC_ACID_LOW_LEVEL [ 浓硝酸低液位检测 ]", MId.IO1_IO, 8, false), - DISTILLED_WATER_LOW_LEVEL("DISTILLED_WATER_LOW_LEVEL [ 蒸馏水低液位检测 ]", MId.IO1_IO, 9, false), - WASTE_LIQUID_BARREL_HIGH_LEVEL("WASTE_LIQUID_BARREL_LOW_LEVEL [ 废液桶高液位检测 ]", MId.IO1_IO, 10, false), + HEATER_TRAY_1_EXIST("HEATER_TRAY_1_EXIST [ 加热模块拍子1到位 ]", MId.IO1_IO, 1, false), + HEATER_TRAY_2_EXIST("HEATER_TRAY_2_EXIST [ 加热模块拍子2到位 ]", MId.IO1_IO, 2, false), + HEATER_TRAY_3_EXIST("HEATER_TRAY_3_EXIST [ 加热模块拍子3到位 ]", MId.IO1_IO, 3, false), + HEATER_TRAY_4_EXIST("HEATER_TRAY_4_EXIST [ 加热模块拍子4到位 ]", MId.IO1_IO, 4, false), + WASTE_EXIST("WASTE_EXIST [ 废液桶存在 ]", MId.IO1_IO, 5, false), + LIQUID_TRAY_EXIST("LIQUID_TRAY_EXIST [ 加液位托盘存在 ]", MId.IO1_IO, 6, false), + THIN_LOW_LEVEL("THIN_LOW_LEVEL [ 稀硝酸低液位检测 ]", MId.IO1_IO, 7, false), + THICK_LOW_LEVEL("THICK_LOW_LEVEL [ 浓硝酸低液位检测 ]", MId.IO1_IO, 8, false), + WATER_LOW_LEVEL("WATER_LOW_LEVEL [ 蒸馏水低液位检测 ]", MId.IO1_IO, 9, false), + WASTE_HIGH_LEVEL("WASTE_HIGH_LEVEL [ 废液桶高液位检测 ]", MId.IO1_IO, 10, false), ; final public String description; - final public MId mid; - final public int ioIndex; - final public boolean mirror; + final public MId mid; + final public int ioIndex; + final public boolean mirror; InputIOMId(String description, MId mid, int ioIndex, boolean mirror) { this.description = description; - this.mid = mid; + this.mid = mid; this.ioIndex = ioIndex; - this.mirror = mirror; + this.mirror = mirror; } } From 1c37283566f3ff23bf90e2cb1224faedc35f3efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Wed, 28 May 2025 11:42:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?add:=E4=BF=AE=E6=94=B9GDDeviceStatusService?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iflytop/sgs/common/enums/DevicePartId.java | 24 +++++++++ .../iflytop/sgs/common/enums/SensorStateCode.java | 31 ++++++++++++ .../common/service/GDDeviceStatusInterface.java | 58 ++++++++++++++++++++++ .../hardware/service/GDDeviceStatusService.java | 20 +++++--- 4 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java create mode 100644 src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java create mode 100644 src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java diff --git a/src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java b/src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java new file mode 100644 index 0000000..c6aed2e --- /dev/null +++ b/src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java @@ -0,0 +1,24 @@ +package com.iflytop.sgs.common.enums; + + +import lombok.Getter; + +@Getter +public enum DevicePartId { + DoorM("门电机"), + LiquidM("加液电机"), + ZM("Z轴电机"), + LiquidPumpM("加液泵"), + HEATER_ROD1_ID("加热棒1"), + HEATER_ROD2_ID("加热棒2"), + HEATER_ROD3_ID("加热棒3"), + HEATER_ROD4_ID("加热棒4"), + ; + private final String description; + + DevicePartId(String description){ + this.description = description; + } + + +} diff --git a/src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java b/src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java new file mode 100644 index 0000000..caa130b --- /dev/null +++ b/src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java @@ -0,0 +1,31 @@ +package com.iflytop.sgs.common.enums; + +import lombok.Getter; + +/** + * 系统配置累 + * + */ +@Getter +public enum SensorStateCode { + E_STOP("急停"), + HEATER_TRAY_1_EXIST("加热位1托盘存在状态"), + HEATER_TRAY_2_EXIST("加热位2托盘存在状态"), + HEATER_TRAY_3_EXIST("加热位3托盘存在状态"), + HEATER_TRAY_4_EXIST("加热位4托盘存在状态"), + WASTE_EXIST("废液桶是否存在"), + LIQUID_TRAY_EXIST("加液区托盘是否存在"), + THIN_LOW_LEVEL("稀硝酸低液位"), + THICK_LOW_LEVEL("浓硝酸低液位"), + WATER_LOW_LEVEL("水低液位"), + WASTE_HIGH_LEVEL("废液高液位"); + + + private String description; + + SensorStateCode(String description) { + this.description = description; + } +} + + diff --git a/src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java b/src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java new file mode 100644 index 0000000..429edb8 --- /dev/null +++ b/src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java @@ -0,0 +1,58 @@ +package com.iflytop.sgs.common.service; + +import com.iflytop.sgs.hardware.exception.HardwareException; +import com.iflytop.sgs.hardware.type.IO.InputIOMId; +import com.iflytop.sgs.hardware.type.Servo.LeisaiServoMId; +import com.iflytop.sgs.hardware.type.StepMotor.StepMotorMId; +import com.iflytop.sgs.hardware.type.driver.HeaterRodSlavedId; + +public interface GDDeviceStatusInterface { + + /** + * 获取步进电机的原点状态 + * @param stepMotorMId + * @return true 在原点 false 不在原点 + */ + Boolean stepMotorIsOrigin(StepMotorMId stepMotorMId) throws HardwareException; + + /** + * 获取XY 伺服的原点状态 + * @param mid + * @return + * @throws HardwareException + */ + Boolean getXYServoIsOrigin(LeisaiServoMId mid) throws HardwareException; + + + /** + * 获取 传感器信号 + * @param inputIOMId + * @return + * @throws HardwareException + */ + Boolean getInputState(String inputIOMId) throws HardwareException; + + /** + * 获取加热棒温度 + * @param heaterRodSlavedId + * @return + * @throws Exception + */ + Double getHeaterRodTemperature(String heaterRodSlavedId) throws Exception; + + /** + * 获取电机位置 + * @param stepMotorMId + * @return + * @throws HardwareException + */ + Double getStepMotorPostion(String stepMotorMId) throws HardwareException; + + /** + * 获取伺服类电机位置 + * @param mid + * @return + * @throws HardwareException + */ + Double getXYServoPosition(LeisaiServoMId mid) throws HardwareException; +} diff --git a/src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java b/src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java index da531cb..c243a34 100644 --- a/src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java +++ b/src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java @@ -1,6 +1,7 @@ package com.iflytop.sgs.hardware.service; import com.iflytop.sgs.app.model.bo.Point3D; +import com.iflytop.sgs.common.service.GDDeviceStatusInterface; import com.iflytop.sgs.hardware.drivers.DIDriver.InputDetectDriver; import com.iflytop.sgs.hardware.drivers.HeaterRodDriver; import com.iflytop.sgs.hardware.drivers.LeisaiServoDriver; @@ -19,7 +20,7 @@ import org.springframework.stereotype.Component; @Slf4j @Component @RequiredArgsConstructor -public class GDDeviceStatusService { +public class GDDeviceStatusService implements GDDeviceStatusInterface { private final InputDetectDriver inputDetectDriver; private final HeaterRodDriver heaterRodDriver; private final StepMotorCtrlDriver stepMotorCtrlDriver; @@ -47,32 +48,35 @@ public class GDDeviceStatusService { } /** - * 获取 拍子 试管架拍子 急停 到位信号 - * @param inputIOMId + * 获取传感器信号 + * @param inputIOMIdStr * @return * @throws HardwareException */ - public Boolean getInputState(InputIOMId inputIOMId) throws HardwareException { + public Boolean getInputState(String inputIOMIdStr) throws HardwareException { + InputIOMId inputIOMId = InputIOMId.valueOf(inputIOMIdStr); return inputDetectDriver.getIOState(inputIOMId); } /** * 获取加热棒温度 - * @param heaterRodSlavedId + * @param heaterRodSlavedIdStr * @return * @throws Exception */ - public Double getHeaterRodTemperature(HeaterRodSlavedId heaterRodSlavedId) throws Exception { + public Double getHeaterRodTemperature(String heaterRodSlavedIdStr) throws Exception { + HeaterRodSlavedId heaterRodSlavedId=HeaterRodSlavedId.valueOf(heaterRodSlavedIdStr); return heaterRodDriver.getTemperature(heaterRodSlavedId); } /** * 获取电机位置 - * @param stepMotorMId + * @param stepMotorMIdStr * @return * @throws HardwareException */ - public Double getStepMotorPostion(StepMotorMId stepMotorMId) throws HardwareException { + public Double getStepMotorPostion(String stepMotorMIdStr) throws HardwareException { + StepMotorMId stepMotorMId=StepMotorMId.valueOf(stepMotorMIdStr); Integer motorPosition = stepMotorCtrlDriver.stepMotorReadPos(stepMotorMId); Double realPosition = StepMotorConverter.toUserPosition(motorPosition); return realPosition;