Browse Source

fix:加液泵去掉方向

master
白凤吉 3 months ago
parent
commit
08bac66d3b
  1. 18
      src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStartCommandHandler.java
  2. 80
      src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java

18
src/main/java/com/iflytop/gd/app/cmd/debug/LiquidPumpStartCommandHandler.java

@ -29,10 +29,8 @@ public class LiquidPumpStartCommandHandler extends BaseCommandHandler {
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
return runAsync(() -> { return runAsync(() -> {
String index = cmdDTO.getStringParam("index"); String index = cmdDTO.getStringParam("index");
String direction = cmdDTO.getStringParam("direction");
Double volume = cmdDTO.getDoubleParam("volume"); Double volume = cmdDTO.getDoubleParam("volume");
Double velocity = cmdDTO.getDoubleParam("velocity"); Double velocity = cmdDTO.getDoubleParam("velocity");
CmdDirection directionEnum = CmdDirection.valueOf(direction);
AcidPumpDevice acidPumpDevice = AcidPumpDevice.valueOf(index); AcidPumpDevice acidPumpDevice = AcidPumpDevice.valueOf(index);
DeviceCommandBundle deviceCommand; DeviceCommandBundle deviceCommand;
if(velocity != null) { if(velocity != null) {
@ -53,14 +51,14 @@ public class LiquidPumpStartCommandHandler extends BaseCommandHandler {
} }
switch (acidPumpDevice) { switch (acidPumpDevice) {
case acid_pump_01 -> deviceCommand = DeviceCommandGenerator.acidPump1Move(directionEnum, volume);
case acid_pump_02 -> deviceCommand = DeviceCommandGenerator.acidPump2Move(directionEnum, volume);
case acid_pump_03 -> deviceCommand = DeviceCommandGenerator.acidPump3Move(directionEnum, volume);
case acid_pump_04 -> deviceCommand = DeviceCommandGenerator.acidPump4Move(directionEnum, volume);
case acid_pump_05 -> deviceCommand = DeviceCommandGenerator.acidPump5Move(directionEnum, volume);
case acid_pump_06 -> deviceCommand = DeviceCommandGenerator.acidPump6Move(directionEnum, volume);
case acid_pump_07 -> deviceCommand = DeviceCommandGenerator.acidPump7Move(directionEnum, volume);
case acid_pump_08 -> deviceCommand = DeviceCommandGenerator.acidPump8Move(directionEnum, volume);
case acid_pump_01 -> deviceCommand = DeviceCommandGenerator.acidPump1MoveBy(volume);
case acid_pump_02 -> deviceCommand = DeviceCommandGenerator.acidPump2MoveBy(volume);
case acid_pump_03 -> deviceCommand = DeviceCommandGenerator.acidPump3MoveBy(volume);
case acid_pump_04 -> deviceCommand = DeviceCommandGenerator.acidPump4MoveBy(volume);
case acid_pump_05 -> deviceCommand = DeviceCommandGenerator.acidPump5MoveBy(volume);
case acid_pump_06 -> deviceCommand = DeviceCommandGenerator.acidPump6MoveBy(volume);
case acid_pump_07 -> deviceCommand = DeviceCommandGenerator.acidPump7MoveBy(volume);
case acid_pump_08 -> deviceCommand = DeviceCommandGenerator.acidPump8MoveBy(volume);
default -> throw new RuntimeException("index 未找到"); default -> throw new RuntimeException("index 未找到");
} }
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);

80
src/main/java/com/iflytop/gd/common/cmd/DeviceCommandGenerator.java

@ -1,7 +1,10 @@
package com.iflytop.gd.common.cmd; package com.iflytop.gd.common.cmd;
import com.iflytop.gd.common.enums.cmd.*;
import com.iflytop.gd.common.enums.cmd.CmdAction;
import com.iflytop.gd.common.enums.cmd.CmdAxis;
import com.iflytop.gd.common.enums.cmd.CmdColor;
import com.iflytop.gd.common.enums.cmd.CmdDevice;
/** /**
* 生成给设备发送的指令 * 生成给设备发送的指令
@ -743,86 +746,77 @@ public class DeviceCommandGenerator {
} }
/** /**
* 加液泵 泵1移动
* 加液泵 泵1相对移动
* *
* @param direction 方向 forward | backward
* @param volume 加液量 单位mL
* @param position 加液量 单位mL
*/ */
public static DeviceCommandBundle acidPump1Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump1MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_1, CmdAction.move, params, "加液泵1 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_1, CmdAction.move_by, params, "加液泵1 相对移动");
} }
/** /**
* 加液泵 泵2移动
* 加液泵 泵2相对移动
*/ */
public static DeviceCommandBundle acidPump2Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump2MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_2, CmdAction.move, params, "加液泵2 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_2, CmdAction.move_by, params, "加液泵2 相对移动");
} }
/** /**
* 加液泵 泵3移动
* 加液泵 泵3相对移动
*/ */
public static DeviceCommandBundle acidPump3Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump3MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_3, CmdAction.move, params, "加液泵3 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_3, CmdAction.move_by, params, "加液泵3 相对移动");
} }
/** /**
* 加液泵 泵4移动
* 加液泵 泵4相对移动
*/ */
public static DeviceCommandBundle acidPump4Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump4MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_4, CmdAction.move, params, "加液泵4 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_4, CmdAction.move_by, params, "加液泵4 相对移动");
} }
/** /**
* 加液泵 泵5移动
* 加液泵 泵5相对移动
*/ */
public static DeviceCommandBundle acidPump5Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump5MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_5, CmdAction.move, params, "加液泵5 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_5, CmdAction.move_by, params, "加液泵5 相对移动");
} }
/** /**
* 加液泵 泵6移动
* 加液泵 泵6相对移动
*/ */
public static DeviceCommandBundle acidPump6Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump6MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_6, CmdAction.move, params, "加液泵6 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_6, CmdAction.move_by, params, "加液泵6 相对移动");
} }
/** /**
* 加液泵 泵7移动
* 加液泵 泵7相对移动
*/ */
public static DeviceCommandBundle acidPump7Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump7MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_7, CmdAction.move, params, "加液泵7 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_7, CmdAction.move_by, params, "加液泵7 相对移动");
} }
/** /**
* 加液泵 泵8移动
* 加液泵 泵8相对移动
*/ */
public static DeviceCommandBundle acidPump8Move(CmdDirection direction, Double volume) {
public static DeviceCommandBundle acidPump8MoveBy(Double position) {
DeviceCommandParams params = new DeviceCommandParams(); DeviceCommandParams params = new DeviceCommandParams();
params.setDirection(direction);
params.setVolume(volume);
return setInfoCmd(CmdDevice.acid_pump_8, CmdAction.move, params, "加液泵8 移动");
params.setPosition(position);
return setInfoCmd(CmdDevice.acid_pump_8, CmdAction.move_by, params, "加液泵8 相对移动");
} }
/** /**

Loading…
Cancel
Save