From 81022acd6c020fe829f27c241fa460d14e3c43d1 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Mon, 17 Feb 2025 15:20:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=91=87=E5=8C=80=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/qyft/gd/common/constant/Commands.java | 7 ++++++- src/main/java/com/qyft/gd/service/CMDService.java | 13 ++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/qyft/gd/common/constant/Commands.java b/src/main/java/com/qyft/gd/common/constant/Commands.java index 7f6f666..db6dc3e 100644 --- a/src/main/java/com/qyft/gd/common/constant/Commands.java +++ b/src/main/java/com/qyft/gd/common/constant/Commands.java @@ -37,7 +37,12 @@ public class Commands { /** * 摇匀试管架 */ - public static final String SHAKE_UP = "shakeUp"; + public static final String START_SHAKE_UP = "startShakeUp"; + + /** + * 停止摇匀试管架 + */ + public static final String STOP_SHAKE_UP = "stopShakeUp"; /** * 开始加热 diff --git a/src/main/java/com/qyft/gd/service/CMDService.java b/src/main/java/com/qyft/gd/service/CMDService.java index 728fcc6..9766b05 100644 --- a/src/main/java/com/qyft/gd/service/CMDService.java +++ b/src/main/java/com/qyft/gd/service/CMDService.java @@ -33,7 +33,8 @@ public class CMDService { commandMap.put(Commands.DOWN_TRAY, this::downTray); commandMap.put(Commands.INJECT_FLUID, this::injectFluid); commandMap.put(Commands.MOVE_TO_ACTION_AREA, this::moveToActionArea); - commandMap.put(Commands.SHAKE_UP, this::shakeUp); + commandMap.put(Commands.START_SHAKE_UP, this::startShakeUp); + commandMap.put(Commands.STOP_SHAKE_UP, this::stopShakeUp); commandMap.put(Commands.START_HEAT, this::startHeat); commandMap.put(Commands.STOP_HEAT, this::stopHeat); commandMap.put(Commands.TAKE_PHOTO, this::takePhoto); @@ -89,8 +90,8 @@ public class CMDService { cmdList.add(() -> deviceService.startHeating((String) cmdForm.getParams().get("areaId"),(Double) cmdForm.getParams().get("temperature"))); return run(cmdList); } -// 摇匀 - private Boolean shakeUp(CMDForm cmdForm) { +// 开始摇匀 + private Boolean startShakeUp(CMDForm cmdForm) { // deviceService.startShaking(); // Timer timer = new Timer(); // TimerTask task = new TimerTask() { @@ -106,6 +107,12 @@ public class CMDService { cmdList.add(() -> deviceService.setShakingSpeed((Integer) cmdForm.getParams().get("speed"))); return run(cmdList); } +// 结束摇匀 + private Boolean stopShakeUp(CMDForm cmdForm) { + List> cmdList = new ArrayList<>(); + cmdList.add(() -> deviceService.stopShaking()); + return run(cmdList); + } // 移至加液 private Boolean moveToActionArea(CMDForm cmdForm) {