|
|
@ -1,6 +1,6 @@ |
|
|
|
package com.iflytop.sgs.hardware.service; |
|
|
|
|
|
|
|
import com.iflytop.sgs.common.service.GDDeviceStatusInterface; |
|
|
|
import com.iflytop.sgs.common.service.GDDeviceStatusService; |
|
|
|
import com.iflytop.sgs.hardware.drivers.DIDriver.InputDetectDriver; |
|
|
|
import com.iflytop.sgs.hardware.drivers.HeaterRodDriver; |
|
|
|
import com.iflytop.sgs.hardware.drivers.LeiSaiServoDriver; |
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component; |
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
public class GDDeviceStatusServiceImpl implements GDDeviceStatusService { |
|
|
|
private final InputDetectDriver inputDetectDriver; |
|
|
|
private final HeaterRodDriver heaterRodDriver; |
|
|
|
private final StepMotorCtrlDriver stepMotorCtrlDriver; |
|
|
@ -30,6 +30,7 @@ public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取步进电机的原点状态 |
|
|
|
* |
|
|
|
* @param stepMotorMId |
|
|
|
* @return true 在原点 false 不在原点 |
|
|
|
*/ |
|
|
@ -39,17 +40,18 @@ public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取XY 伺服的原点状态 |
|
|
|
* |
|
|
|
* @param mid |
|
|
|
* @return |
|
|
|
* @throws HardwareException |
|
|
|
*/ |
|
|
|
public Boolean getXYServoIsOrigin(LeisaiServoMId mid) throws HardwareException |
|
|
|
{ |
|
|
|
public Boolean getXYServoIsOrigin(LeisaiServoMId mid) throws HardwareException { |
|
|
|
return leisaiServoDriver.readIoState(mid, 0); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取传感器信号 |
|
|
|
* |
|
|
|
* @param inputIOMIdStr |
|
|
|
* @return |
|
|
|
* @throws HardwareException |
|
|
@ -61,23 +63,25 @@ public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取加热棒温度 |
|
|
|
* |
|
|
|
* @param heaterRodSlavedIdStr |
|
|
|
* @return |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
public Double getHeaterRodTemperature(String heaterRodSlavedIdStr) throws Exception { |
|
|
|
HeaterRodSlavedId heaterRodSlavedId=HeaterRodSlavedId.valueOf(heaterRodSlavedIdStr); |
|
|
|
HeaterRodSlavedId heaterRodSlavedId = HeaterRodSlavedId.valueOf(heaterRodSlavedIdStr); |
|
|
|
return heaterRodDriver.getTemperature(heaterRodSlavedId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取电机位置 |
|
|
|
* |
|
|
|
* @param stepMotorMIdStr |
|
|
|
* @return |
|
|
|
* @throws HardwareException |
|
|
|
*/ |
|
|
|
public Double getStepMotorPostion(String stepMotorMIdStr) throws HardwareException { |
|
|
|
StepMotorMId stepMotorMId=StepMotorMId.valueOf(stepMotorMIdStr); |
|
|
|
StepMotorMId stepMotorMId = StepMotorMId.valueOf(stepMotorMIdStr); |
|
|
|
Integer motorPosition = stepMotorCtrlDriver.stepMotorReadPos(stepMotorMId); |
|
|
|
Double realPosition = StepMotorConverter.toUserPosition(motorPosition); |
|
|
|
return realPosition; |
|
|
@ -85,12 +89,14 @@ public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取伺服类电机位置 |
|
|
|
* |
|
|
|
* @param mid |
|
|
|
* @return |
|
|
|
* @throws HardwareException |
|
|
|
*/ |
|
|
|
public Double getXYServoPosition(LeisaiServoMId mid) throws HardwareException { |
|
|
|
int servoPosition = leisaiServoDriver.readPosition(mid); |
|
|
|
public Double getXYServoPosition(String mid) throws HardwareException { |
|
|
|
LeisaiServoMId leisaiServoMId = LeisaiServoMId.valueOf(mid.toString()); |
|
|
|
int servoPosition = leisaiServoDriver.readPosition(leisaiServoMId); |
|
|
|
return StepMotorConverter.toUserPosition(servoPosition); |
|
|
|
} |
|
|
|
|
|
|
@ -100,8 +106,9 @@ public class GDDeviceStatusService implements GDDeviceStatusInterface { |
|
|
|
* @return |
|
|
|
* @throws HardwareException |
|
|
|
*/ |
|
|
|
public Integer readLiquidValvePosition(LiquidValveMId mid) throws HardwareException { |
|
|
|
return liquidValveDriver.readValveHoleIndex(mid); |
|
|
|
public Integer readLiquidValvePosition(String mid) throws HardwareException { |
|
|
|
LiquidValveMId liquidValveMId = LiquidValveMId.valueOf(mid); |
|
|
|
return liquidValveDriver.readValveHoleIndex(liquidValveMId); |
|
|
|
} |
|
|
|
|
|
|
|
} |