Browse Source

样本添加时及时关门

master
sige 1 year ago
parent
commit
1944147ee7
  1. 15
      src/src/main/java/com/my/graphiteDigesterBg/resource/ResHeatingTubeRackSlotManager.java
  2. 5
      src/src/main/java/com/my/graphiteDigesterBg/task/TaskSampleAdd.java

15
src/src/main/java/com/my/graphiteDigesterBg/resource/ResHeatingTubeRackSlotManager.java

@ -12,6 +12,8 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase {
private final List<ResHeatingTubeRackSlot> slots; private final List<ResHeatingTubeRackSlot> slots;
// error slot index // error slot index
private Integer errorSlotIndex; private Integer errorSlotIndex;
// temperature refresh timer
private Timer temperatureRefreshTimer;
// constructor // constructor
public ResHeatingTubeRackSlotManager() { public ResHeatingTubeRackSlotManager() {
@ -28,10 +30,12 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase {
this.errorSlotIndex = this.getDevice().getEnv().getProperty("app.errorSlotIndex",Integer.class); this.errorSlotIndex = this.getDevice().getEnv().getProperty("app.errorSlotIndex",Integer.class);
assert Objects.nonNull(this.errorSlotIndex); assert Objects.nonNull(this.errorSlotIndex);
this.slots.get(this.errorSlotIndex).setupAsErrorSlot(); this.slots.get(this.errorSlotIndex).setupAsErrorSlot();
}
// start a timer task to refresh slot temperature every 5 seconds
var timer = new Timer();
timer.schedule(new TimerTask() {
// start temperature refresh
public void startTemperatureRefresh() {
this.temperatureRefreshTimer = new Timer();
this.temperatureRefreshTimer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
ResHeatingTubeRackSlotManager.this.refreshSlotTemperature(); ResHeatingTubeRackSlotManager.this.refreshSlotTemperature();
@ -39,6 +43,11 @@ public class ResHeatingTubeRackSlotManager extends DiResourceManagerBase {
}, 0, 5000); }, 0, 5000);
} }
// stop temperature refresh
public void stopTemperatureRefresh() {
this.temperatureRefreshTimer.cancel();
}
// refresh slot temperature // refresh slot temperature
public void refreshSlotTemperature() { public void refreshSlotTemperature() {
var registers = this.getDevice().getRegisters(); var registers = this.getDevice().getRegisters();

5
src/src/main/java/com/my/graphiteDigesterBg/task/TaskSampleAdd.java

@ -37,9 +37,12 @@ public class TaskSampleAdd extends DiTaskBase {
liquidPlateMotor.moveTo("LiquidPlatePlaceTubeRack"); liquidPlateMotor.moveTo("LiquidPlatePlaceTubeRack");
// 等待用户添加完成 // 等待用户添加完成
this.waitForUserAction(); this.waitForUserAction();
// 关闭设备门
doorMotor.moveToIO(1, 1);
if ( "canceled".equals(this.addStatus) ) { if ( "canceled".equals(this.addStatus) ) {
slot.unlock(); slot.unlock();
this.setStatus(TaskStatus.FINISHED); this.setStatus(TaskStatus.FINISHED);
return;
} }
var moveMoveTubeRackFromLiquidPlateToHeatPlate = new MoveMoveTubeRackFromLiquidPlateToHeatPlate(); var moveMoveTubeRackFromLiquidPlateToHeatPlate = new MoveMoveTubeRackFromLiquidPlateToHeatPlate();
@ -47,8 +50,6 @@ public class TaskSampleAdd extends DiTaskBase {
moveMoveTubeRackFromLiquidPlateToHeatPlate.setDevice(this.getDevice()); moveMoveTubeRackFromLiquidPlateToHeatPlate.setDevice(this.getDevice());
moveMoveTubeRackFromLiquidPlateToHeatPlate.run(); moveMoveTubeRackFromLiquidPlateToHeatPlate.run();
// 关闭设备门
doorMotor.moveToIO(1, 1);
this.setStatus(TaskStatus.FINISHED); this.setStatus(TaskStatus.FINISHED);
} }

Loading…
Cancel
Save