5 changed files with 152 additions and 8 deletions
-
3src/main/java/a8k/appbean/HardwareException.java
-
8src/main/java/a8k/appbean/ecode/AppEcode.java
-
23src/main/java/a8k/service/ctrl_service/DeviceInitializationCtrlService.java
-
126src/main/java/a8k/service/hardware/CommonHardwareOpeartion.java
-
BINzhaohe_app.db
@ -0,0 +1,126 @@ |
|||||
|
package a8k.service.hardware; |
||||
|
|
||||
|
import a8k.a8k_can_protocol.A8kEcode; |
||||
|
import a8k.a8k_can_protocol.MId; |
||||
|
import a8k.appbean.HardwareException; |
||||
|
import a8k.appbean.ecode.AppEcode; |
||||
|
import a8k.base_hardware.A8kCanBusService; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Component |
||||
|
public class CommonHardwareOpeartion { |
||||
|
|
||||
|
|
||||
|
@Resource |
||||
|
A8kCanBusService canBus; |
||||
|
|
||||
|
public AppEcode enableAllMotorNoExcep() { |
||||
|
try { |
||||
|
enableAllMotor(); |
||||
|
} catch (HardwareException e) { |
||||
|
return new AppEcode(e); |
||||
|
} |
||||
|
return new AppEcode(A8kEcode.Success); |
||||
|
} |
||||
|
|
||||
|
public AppEcode disableAllMotorNoExcep() { |
||||
|
try { |
||||
|
enableAllMotor(); |
||||
|
} catch (HardwareException e) { |
||||
|
return new AppEcode(e); |
||||
|
} |
||||
|
return new AppEcode(A8kEcode.Success); |
||||
|
} |
||||
|
|
||||
|
public void enableAllMotor() throws HardwareException { |
||||
|
//进出料初始化 |
||||
|
canBus.stepMotorEnable(MId.FeedingModInfeedM, 1); |
||||
|
canBus.stepMotorEnable(MId.FeedingModXM, 1); |
||||
|
canBus.stepMotorEnable(MId.FeedingModOutfeedM, 1); |
||||
|
|
||||
|
//摇匀模组初始化 |
||||
|
canBus.stepMotorEnable(MId.ShakeModClampingM, 1); |
||||
|
canBus.stepMotorEnable(MId.ShakeModGripperZM, 1); |
||||
|
canBus.stepMotorEnable(MId.ShakeModShakeM, 1); |
||||
|
canBus.miniServoEnable(MId.ShakeModGripperYM, 1); |
||||
|
canBus.miniServoEnable(MId.ShakeModGripperSV, 1); |
||||
|
canBus.miniServoEnable(MId.ShakeModTubeScanerClampingSV, 1); |
||||
|
canBus.miniServoEnable(MId.ShakeModTubeScanerRotateSV, 1); |
||||
|
|
||||
|
//板夹仓初始化 |
||||
|
canBus.stepMotorEnable(MId.PlatesBoxYM, 1); |
||||
|
canBus.stepMotorEnable(MId.PlatesBoxPusherM, 1); |
||||
|
|
||||
|
//光学模组初始化 |
||||
|
canBus.stepMotorEnable(MId.OptModPullM, 1); |
||||
|
canBus.stepMotorEnable(MId.OptModScannerM, 1); |
||||
|
|
||||
|
//HBot初始化 |
||||
|
canBus.stepMotorEnable(MId.HbotM, 1); |
||||
|
canBus.stepMotorEnable(MId.PipetteModZM, 1); |
||||
|
|
||||
|
//转盘归零 |
||||
|
canBus.stepMotorEnable(MId.IncubatorRotateCtrlM, 1); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void disableAllMotor() throws HardwareException { |
||||
|
//进出料初始化 |
||||
|
canBus.stepMotorEnable(MId.FeedingModInfeedM, 0); |
||||
|
canBus.stepMotorEnable(MId.FeedingModXM, 0); |
||||
|
canBus.stepMotorEnable(MId.FeedingModOutfeedM, 0); |
||||
|
|
||||
|
//摇匀模组初始化 |
||||
|
canBus.stepMotorEnable(MId.ShakeModClampingM, 0); |
||||
|
canBus.stepMotorEnable(MId.ShakeModGripperZM, 0); |
||||
|
canBus.stepMotorEnable(MId.ShakeModShakeM, 0); |
||||
|
canBus.miniServoEnable(MId.ShakeModGripperYM, 0); |
||||
|
canBus.miniServoEnable(MId.ShakeModGripperSV, 0); |
||||
|
canBus.miniServoEnable(MId.ShakeModTubeScanerClampingSV, 0); |
||||
|
canBus.miniServoEnable(MId.ShakeModTubeScanerRotateSV, 0); |
||||
|
|
||||
|
//板夹仓初始化 |
||||
|
canBus.stepMotorEnable(MId.PlatesBoxYM, 0); |
||||
|
canBus.stepMotorEnable(MId.PlatesBoxPusherM, 0); |
||||
|
|
||||
|
//光学模组初始化 |
||||
|
canBus.stepMotorEnable(MId.OptModPullM, 0); |
||||
|
canBus.stepMotorEnable(MId.OptModScannerM, 0); |
||||
|
|
||||
|
//HBot初始化 |
||||
|
canBus.stepMotorEnable(MId.HbotM, 0); |
||||
|
canBus.stepMotorEnable(MId.PipetteModZM, 0); |
||||
|
|
||||
|
//转盘归零 |
||||
|
canBus.stepMotorEnable(MId.IncubatorRotateCtrlM, 0); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void stopAllMOtor() { |
||||
|
//进出料初始化 |
||||
|
try {canBus.moduleStop(MId.FeedingModInfeedM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.FeedingModXM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.FeedingModOutfeedM);} catch (HardwareException ignored) {} |
||||
|
//摇匀模组初始化 |
||||
|
try {canBus.moduleStop(MId.ShakeModClampingM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModGripperZM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModShakeM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModGripperYM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModGripperSV);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModTubeScanerClampingSV);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.ShakeModTubeScanerRotateSV);} catch (HardwareException ignored) {} |
||||
|
//板夹仓初始化 |
||||
|
try {canBus.moduleStop(MId.PlatesBoxYM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.PlatesBoxPusherM);} catch (HardwareException ignored) {} |
||||
|
//光学模组初始化 |
||||
|
try {canBus.moduleStop(MId.OptModPullM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.OptModScannerM);} catch (HardwareException ignored) {} |
||||
|
//HBot初始化 |
||||
|
try {canBus.moduleStop(MId.HbotM);} catch (HardwareException ignored) {} |
||||
|
try {canBus.moduleStop(MId.PipetteModZM);} catch (HardwareException ignored) {} |
||||
|
//转盘归零 |
||||
|
try {canBus.moduleStop(MId.IncubatorRotateCtrlM);} catch (HardwareException ignored) {} |
||||
|
|
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue