You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.6 KiB
43 lines
1.6 KiB
package com.iflytop.gd.app.cmd;
|
|
|
|
import com.iflytop.gd.app.core.BaseCommandHandler;
|
|
import com.iflytop.gd.app.model.dto.CmdDTO;
|
|
import com.iflytop.gd.app.service.DeviceCommandUtilService;
|
|
import com.iflytop.gd.app.service.DeviceStateService;
|
|
import com.iflytop.gd.app.service.SelfTestService;
|
|
import com.iflytop.gd.common.annotation.CommandMapping;
|
|
import com.iflytop.gd.hardware.drivers.DODriver.OutputIOCtrlDriver;
|
|
import com.iflytop.gd.hardware.service.IOService;
|
|
import com.iflytop.gd.hardware.type.IO.OutputIOMId;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
/**
|
|
* 拍子升降回原点
|
|
*/
|
|
@Slf4j
|
|
@Component
|
|
@RequiredArgsConstructor
|
|
@CommandMapping("cap_lifting_origin")//业务指令注解
|
|
public class CapLiftingOriginCommand extends BaseCommandHandler {
|
|
private final DeviceCommandUtilService deviceCommandUtilService;
|
|
private final SelfTestService selfTestService;
|
|
private final OutputIOCtrlDriver outputIOCtrlDriver;
|
|
|
|
@Override
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
|
|
return runAsync(() -> {
|
|
outputIOCtrlDriver.open(OutputIOMId.DO_TRAY_MOTOR_CLAMP);
|
|
//拍子升降回原点
|
|
deviceCommandUtilService.trayMotorOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
|
|
outputIOCtrlDriver.close(OutputIOMId.DO_TRAY_MOTOR_CLAMP);
|
|
//将拍子升降是否在原点状态设置为true
|
|
selfTestService.getSelfTestState().setCapLiftingOrigin(true);
|
|
|
|
});
|
|
}
|
|
}
|
|
|