|
|
@ -31,8 +31,14 @@ public class DebugMotorZMoveToCommand extends BaseCommandHandler { |
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) throws Exception { |
|
|
|
Double position = cmdDTO.getDoubleParam("position"); |
|
|
|
Double speed = cmdDTO.getDoubleParam("speed"); |
|
|
|
Assert.notNull(position, ()->new AppException(ResultCode.INVALID_PARAMETER)); |
|
|
|
return runAsync(() -> { |
|
|
|
if (speed != null) { |
|
|
|
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZSet(speed); |
|
|
|
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|
|
|
CommandUtil.wait(deviceCommandFuture); |
|
|
|
} |
|
|
|
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZMove(position); |
|
|
|
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|
|
|
CommandUtil.wait(deviceCommandFuture); |
|
|
|