diff --git a/src/main/java/a8k/app/service/mainctrl/AppDeviceInitCtrlService.java b/src/main/java/a8k/app/service/mainctrl/AppDeviceInitCtrlService.java index 501d506..36d451c 100644 --- a/src/main/java/a8k/app/service/mainctrl/AppDeviceInitCtrlService.java +++ b/src/main/java/a8k/app/service/mainctrl/AppDeviceInitCtrlService.java @@ -136,19 +136,6 @@ public class AppDeviceInitCtrlService { /** - * 设备初始化(同步操作) - * @return 设备自检结果 - * @throws AppException e - */ - synchronized public List initDevice() throws AppException { - try { - return doDeviceMoveToZero(); - } catch (AppException e) { - throw e; - } - } - - /** * 设备初始化(异步操作) * @throws AppException e */ @@ -186,7 +173,7 @@ public class AppDeviceInitCtrlService { state.passed = false; state.deviceInited = false; if (e.getError().code.equals(A8kEcode.APPE_DEVICE_INIT_CHECK_FAIL)) { - state.promopt = buildAppPromopt(checkResults); + state.promopt = buildAppPrompt(checkResults); } else { state.promopt = ZAppPromoptFactory.buildAppPromopt(e); } @@ -197,6 +184,16 @@ public class AppDeviceInitCtrlService { workThread.start(); } + /** + * 设备初始化(同步操作) + * @return 设备自检结果 + * @throws AppException e + */ + synchronized public List initDevice() throws AppException { + return doDeviceMoveToZero(); + } + + //****************************************************************************************** // PRIVATE //****************************************************************************************** @@ -220,6 +217,41 @@ public class AppDeviceInitCtrlService { } + private List doDeviceMoveToZero() throws AppException { + + List results = checkBeforeInitDevice(); + if (virtualDevice.isEnable()) { + virtualDevice.doVirtualThings("初始化设备"); + gstate.setDeviceInited(true); + return results; + } + + for (CheckResult result : results) { + if (!result.pass) { + log.info("设备初始化失败: check {} fail", result.info); + // doSomeThingWhenError(); + return results; + } + } + + moveAllMotorToZero(); + + //弹出试管架 + tubeFeedingCtrlService.ejectTubeHolder(); + tubeFeedingCtrlService.moveTubeRackMoveToEnterPos(); + //初始化tip + hbotMoveExCtrlService.moveToDropTipXYPos(); + pipetteCtrlDriverV2.zMotorMoveToTipDepositBlock(); + pipetteCtrlDriverV2.initPumpDeviceBlock(); + //hbot快速归零 + hbotMoveExCtrlService.moveQuickToZero(); + + gstate.setDeviceInited(true); + gstate.clearFatalError(); + + return results; + } + private void moveAllMotorToZero() throws AppException { moduleEnableCtrlDriver.enableAllMotor(); try { @@ -273,44 +305,7 @@ public class AppDeviceInitCtrlService { }//HBot初始化 } - - private List doDeviceMoveToZero() throws AppException { - - List results = checkBeforeInitDevice(); - if (virtualDevice.isEnable()) { - virtualDevice.doVirtualThings("初始化设备"); - gstate.setDeviceInited(true); - return results; - } - - for (CheckResult result : results) { - if (!result.pass) { - log.info("设备初始化失败: check {} fail", result.info); - // doSomeThingWhenError(); - return results; - } - } - - moveAllMotorToZero(); - - //弹出试管架 - tubeFeedingCtrlService.ejectTubeHolder(); - tubeFeedingCtrlService.moveTubeRackMoveToEnterPos(); - //初始化tip - hbotMoveExCtrlService.moveToDropTipXYPos(); - pipetteCtrlDriverV2.zMotorMoveToTipDepositBlock(); - pipetteCtrlDriverV2.initPumpDeviceBlock(); - //hbot快速归零 - hbotMoveExCtrlService.moveQuickToZero(); - - gstate.setDeviceInited(true); - gstate.clearFatalError(); - - return results; - } - - - private static ZAppPromopt buildAppPromopt(List checkResults) { + private static ZAppPromopt buildAppPrompt(List checkResults) { List detailInfos = new ArrayList<>(); for (CheckResult checkResult : checkResults) { @@ -330,7 +325,6 @@ public class AppDeviceInitCtrlService { result.type = checkPoint.type; result.info = checkPoint.typechinfo; - // if (virtualDevice.isEnable()) { result.pass = true; } else { diff --git a/src/main/java/a8k/app/service/statemgr/GStateMgrService.java b/src/main/java/a8k/app/service/statemgr/GStateMgrService.java index 1962a18..f207c5f 100644 --- a/src/main/java/a8k/app/service/statemgr/GStateMgrService.java +++ b/src/main/java/a8k/app/service/statemgr/GStateMgrService.java @@ -59,9 +59,6 @@ public class GStateMgrService { this.gState.deviceRunMode = deviceRunMode; } - // public String appVersion = AppConstant.APP_VERSION; - // public String mcuVersion = "NOTSET"; - // public String sn = "SN25010001";//25年第一个月,第一台设备,后续改成通过10板的单片机获取 public synchronized String getAppVersion() { return this.gState.appVersion;