|
|
@ -25,12 +25,64 @@ public class DeviceInitializationCtrlService { |
|
|
|
A8kCanBusService canBus; |
|
|
|
|
|
|
|
@Resource |
|
|
|
CommonHardwareOpeartion hardwareOpeartion; |
|
|
|
CommonHardwareOpeartion commonHardOpera; |
|
|
|
|
|
|
|
@Resource |
|
|
|
SamplesPreProcessModuleCtrlParamsService samplesPreProcessModuleCtrlParams; |
|
|
|
|
|
|
|
|
|
|
|
public AppEcode initializeDevice() { |
|
|
|
logger.info("Initializing device ..."); |
|
|
|
try { |
|
|
|
/* |
|
|
|
* 复位思路 |
|
|
|
* 硬件初始化: |
|
|
|
* 检查 |
|
|
|
* 复位 |
|
|
|
* 清空耗材 |
|
|
|
*/ |
|
|
|
|
|
|
|
AppEcode ecode; |
|
|
|
//硬件光电初始化 |
|
|
|
ecode = hardwareStaticInit(); |
|
|
|
if (!ecode.isOk()) { |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
//检查设备状态 |
|
|
|
ecode = checkDeviceState(); |
|
|
|
if (!ecode.isOk()) { |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
//复位设备 |
|
|
|
// ecode = moveMotorToZero(); |
|
|
|
// if (!ecode.isOk()) { |
|
|
|
// return ecode; |
|
|
|
// } |
|
|
|
//清空耗材 |
|
|
|
|
|
|
|
|
|
|
|
} catch (HardwareException e) { |
|
|
|
logger.error("HardwareException %s", e); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
logger.error("InterruptedException", e); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} finally { |
|
|
|
try { |
|
|
|
canBus.stepMotorEnable(MId.ShakeModClampingM, 1); |
|
|
|
canBus.stepMotorEasyMoveBy(MId.ShakeModClampingM, 2); |
|
|
|
canBus.waitForMod(MId.ShakeModClampingM, actionOvertime); |
|
|
|
commonHardOpera.forceStopAndDisableAllMOtor(); |
|
|
|
} catch (HardwareException | InterruptedException ignored) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new AppEcode(A8kEcode.Success); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AppEcode hardwareStaticInit() throws HardwareException, InterruptedException { |
|
|
|
/* |
|
|
|
* 硬件初始化: |
|
|
@ -39,7 +91,7 @@ public class DeviceInitializationCtrlService { |
|
|
|
* 3.使能所有电机 |
|
|
|
*/ |
|
|
|
|
|
|
|
hardwareOpeartion.enableAllMotor(); |
|
|
|
commonHardOpera.enableAllMotor(); |
|
|
|
|
|
|
|
//打开必要的电源 |
|
|
|
canBus.setIOState(IOId.RecycleBinOverflowPPSPowerCtrl, true); |
|
|
@ -145,56 +197,4 @@ public class DeviceInitializationCtrlService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AppEcode initializeDevice() { |
|
|
|
logger.info("Initializing device ..."); |
|
|
|
try { |
|
|
|
/* |
|
|
|
* 复位思路 |
|
|
|
* 硬件初始化: |
|
|
|
* 检查 |
|
|
|
* 复位 |
|
|
|
* 清空耗材 |
|
|
|
*/ |
|
|
|
|
|
|
|
AppEcode ecode; |
|
|
|
//硬件光电初始化 |
|
|
|
ecode = hardwareStaticInit(); |
|
|
|
if (!ecode.isOk()) { |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
//检查设备状态 |
|
|
|
ecode = checkDeviceState(); |
|
|
|
if (!ecode.isOk()) { |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
//复位设备 |
|
|
|
ecode = moveMotorToZero(); |
|
|
|
if (!ecode.isOk()) { |
|
|
|
return ecode; |
|
|
|
} |
|
|
|
|
|
|
|
//清空耗材 |
|
|
|
|
|
|
|
|
|
|
|
} catch (HardwareException e) { |
|
|
|
logger.error("HardwareException %s", e); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
logger.error("InterruptedException", e); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} finally { |
|
|
|
try { |
|
|
|
canBus.stepMotorEnable(MId.ShakeModClampingM, 1); |
|
|
|
canBus.stepMotorEasyMoveBy(MId.ShakeModClampingM, 2); |
|
|
|
canBus.waitForMod(MId.ShakeModClampingM, actionOvertime); |
|
|
|
} catch (HardwareException | InterruptedException ignored) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new AppEcode(A8kEcode.Success); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |