diff --git a/app.db b/app.db index aa5307b..0c7dc3f 100644 Binary files a/app.db and b/app.db differ diff --git a/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java b/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java new file mode 100644 index 0000000..ce8d458 --- /dev/null +++ b/src/main/java/a8k/hardware/A8kPipetteCtrlModule.java @@ -0,0 +1,158 @@ +package a8k.hardware; + +import a8k.hardware.type.a8kcanprotocol.CmdId; +import a8k.hardware.type.a8kcanprotocol.MId; +import a8k.type.HardwareException; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class A8kPipetteCtrlModule { + + @Resource + A8kCanBusService canBusService; + + final Integer overtime = 10000; + /* + virtual int32_t pipette_zmotor_enable(int32_t enable); + virtual int32_t pipette_zmotor_move_zero(); + virtual int32_t pipette_zmotor_move_to_zero_point_quick(); + virtual int32_t pipette_zmotor_measure_distance(); + virtual int32_t pipette_zmotor_read_measure_distance_result(int32_t *result0); + virtual int32_t pipette_zmotor_move_by(int32_t distance); + virtual int32_t pipette_zmotor_move_to(int32_t position); + + virtual int32_t pipette_init_device(); + virtual int32_t pipette_put_tip(); + virtual int32_t pipette_lld_prepare(); + virtual int32_t pipette_lld(int32_t lldtype, int32_t zdpos, int32_t c_threshold, int32_t p_threshold); + virtual int32_t pipette_aspirate_prepare(); + virtual int32_t pipette_aspirate_set_llf_velocity(int32_t llf_zm_rpm); + virtual int32_t pipette_aspirate_set_operation_verifi_p_thre(int32_t p_thre); + virtual int32_t pipette_aspirate_set_operation_verifi_eigen_time(int32_t eigen_time); + virtual int32_t pipette_aspirate_set_operation_verifi_tolerance(int32_t tolerance); + virtual int32_t pipette_aspirate(int32_t ul); + virtual int32_t pipette_aspirate_and_verify(int32_t ul); + virtual int32_t pipette_shake_up(int32_t ul, int32_t times); + virtual int32_t pipette_aspirate_infer_pressure(int32_t ul); + virtual int32_t pipette_aspirate_infer_eigen_time(int32_t ul); + virtual int32_t pipette_get_aspirate_infer_pressure_result(int32_t *result); + virtual int32_t pipette_get_aspirate_infer_eigen_time_result(int32_t *result); + + virtual int32_t pipette_get_sensor_sample_data(int32_t index, int32_t *motor_pos, int32_t *cval, int32_t *pval); + virtual int32_t pipette_get_sensor_sample_data_num(int32_t *num); + virtual int32_t pipette_zmotor_read_zero_point_state(int32_t *state); + virtual int32_t pipette_zmotor_read_dev_status_cache(int32_t *devStatus); + */ + + + public void zMotorEnable(int enable) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_enable.toInt(), enable); + } + + public void zMotorMoveZeroBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_zero.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveToZeroPointQuickBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_to_zero_point_quick.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveByBlock(int distance) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_by.toInt(), distance); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void zMotorMoveToBlock(int position) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_zmotor_move_to.toInt(), position); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void initDeviceBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_init_device.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void putTipBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_put_tip.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void lldPrepareBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_lld_prepare.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void lldBlock(int lldtype, int zdpos, int c_threshold, int p_threshold) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_lld.toInt(), lldtype, zdpos, c_threshold, p_threshold); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + + public void aspiratePrepareBlock() throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_prepare.toInt()); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateSetLlfVelocity(int llf_zm_rpm) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_llf_velocity.toInt(), llf_zm_rpm); + } + + public void aspirateSetOperationVerifPThre(int p_thre) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_p_thre.toInt(), p_thre); + } + + public void aspirateSetOperationVerifEigenTime(int eigen_time) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_eigen_time.toInt(), eigen_time); + } + + public void aspirateSetOperationVerifTolerance(int tolerance) throws HardwareException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_set_operation_verifi_tolerance.toInt(), tolerance); + } + + public void aspirateBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateAndVerifyBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_and_verify.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void shakeUpBlock(int ul, int times) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_shake_up.toInt(), ul, times); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateInferPressureBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_infer_pressure.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void aspirateInferEigenTimeBlock(int ul) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_aspirate_infer_eigen_time.toInt(), ul); + canBusService.waitForMod(MId.PipetteMod, overtime); + } + + public void getAspirateInferPressureResult(int[] result) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_aspirate_infer_pressure_result.toInt()); + } + + public void getAspirateInferEigenTimeResultBlock(int[] result) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_aspirate_infer_eigen_time_result.toInt()); + } + + public void getSensorSampleData(int index, int[] motor_pos, int[] cval, int[] pval) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_sensor_sample_data.toInt(), index); + } + + public void getSensorSampleDataNum(int[] num) throws HardwareException, InterruptedException { + canBusService.callcmd(MId.PipetteMod.toInt(), CmdId.pipette_get_sensor_sample_data_num.toInt()); + } +}