|
|
@ -70,15 +70,38 @@ void OpticalModuleV2::initialize(int32_t moduleid, hardware_config_t* hardwarecf |
|
|
|
m_reg.scan_step_interval = 1; |
|
|
|
m_reg.scan_pointnum = 1200; |
|
|
|
|
|
|
|
m_reg.scan_vstart = 400; |
|
|
|
m_reg.scan_vstop = 400; |
|
|
|
m_reg.scan_v1 = 550; |
|
|
|
m_reg.scan_a1 = 300; |
|
|
|
m_reg.scan_d1 = 300; |
|
|
|
m_reg.scan_amax = 1000; |
|
|
|
m_reg.scan_dmax = 1000; |
|
|
|
m_reg.scan_vdefault = 1200; |
|
|
|
m_reg.scan_tzerowait = 0; |
|
|
|
m_reg.f_scan_vdefault = 300; |
|
|
|
m_reg.f_scan_vstart = 300; |
|
|
|
m_reg.f_scan_a1 = 300; |
|
|
|
m_reg.f_scan_amax = 300; |
|
|
|
m_reg.f_scan_v1 = 300; |
|
|
|
m_reg.f_scan_dmax = 300; |
|
|
|
m_reg.f_scan_d1 = 300; |
|
|
|
m_reg.f_scan_vstop = 300; |
|
|
|
m_reg.f_scan_tzerowait = 0; |
|
|
|
m_reg.f_scan_irun = 12; |
|
|
|
|
|
|
|
m_reg.t_scan_vdefault = 300; |
|
|
|
m_reg.t_scan_vstart = 300; |
|
|
|
m_reg.t_scan_a1 = 300; |
|
|
|
m_reg.t_scan_amax = 300; |
|
|
|
m_reg.t_scan_v1 = 300; |
|
|
|
m_reg.t_scan_dmax = 300; |
|
|
|
m_reg.t_scan_d1 = 300; |
|
|
|
m_reg.t_scan_vstop = 300; |
|
|
|
m_reg.t_scan_tzerowait = 0; |
|
|
|
m_reg.t_scan_irun = 12; |
|
|
|
|
|
|
|
m_reg.barcode_scan_vdefault = 300; |
|
|
|
m_reg.barcode_scan_vstart = 300; |
|
|
|
m_reg.barcode_scan_a1 = 300; |
|
|
|
m_reg.barcode_scan_amax = 300; |
|
|
|
m_reg.barcode_scan_v1 = 300; |
|
|
|
m_reg.barcode_scan_dmax = 300; |
|
|
|
m_reg.barcode_scan_d1 = 300; |
|
|
|
m_reg.barcode_scan_vstop = 300; |
|
|
|
m_reg.barcode_scan_tzerowait = 0; |
|
|
|
m_reg.barcode_scan_irun = 12; |
|
|
|
|
|
|
|
m_default_reg = m_reg; |
|
|
|
|
|
|
@ -157,15 +180,36 @@ int32_t OpticalModuleV2::module_set_reg(int32_t regindex, int32_t val) { |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_reverse_scan_pos_offset, (m_reg.t_reverse_scan_pos_offset)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_reverse_scan_pos_offset, (m_reg.f_reverse_scan_pos_offset)); |
|
|
|
|
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_vdefault, (m_reg.scan_vdefault)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_vstart, (m_reg.scan_vstart)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_a1, (m_reg.scan_a1)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_amax, (m_reg.scan_amax)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_v1, (m_reg.scan_v1)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_dmax, (m_reg.scan_dmax)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_d1, (m_reg.scan_d1)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_vstop, (m_reg.scan_vstop)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_tzerowait, (m_reg.scan_tzerowait)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_vdefault, m_reg.f_scan_vdefault); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_vstart, m_reg.f_scan_vstart); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_a1, m_reg.f_scan_a1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_amax, m_reg.f_scan_amax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_v1, m_reg.f_scan_v1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_dmax, m_reg.f_scan_dmax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_d1, m_reg.f_scan_d1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_vstop, m_reg.f_scan_vstop); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_tzerowait, m_reg.f_scan_tzerowait); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_f_scan_irun, m_reg.f_scan_irun); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_vdefault, m_reg.t_scan_vdefault); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_vstart, m_reg.t_scan_vstart); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_a1, m_reg.t_scan_a1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_amax, m_reg.t_scan_amax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_v1, m_reg.t_scan_v1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_dmax, m_reg.t_scan_dmax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_d1, m_reg.t_scan_d1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_vstop, m_reg.t_scan_vstop); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_tzerowait, m_reg.t_scan_tzerowait); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_t_scan_irun, m_reg.t_scan_irun); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_vdefault, m_reg.barcode_scan_vdefault); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_vstart, m_reg.barcode_scan_vstart); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_a1, m_reg.barcode_scan_a1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_amax, m_reg.barcode_scan_amax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_v1, m_reg.barcode_scan_v1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_dmax, m_reg.barcode_scan_dmax); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_d1, m_reg.barcode_scan_d1); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_vstop, m_reg.barcode_scan_vstop); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_tzerowait, m_reg.barcode_scan_tzerowait); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_barcode_scan_irun, m_reg.barcode_scan_irun); |
|
|
|
|
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_step_interval, (m_reg.scan_step_interval)); |
|
|
|
MODULE_REG_CASE__SET_REG_TO(kreg_a8k_opt_scan_pointnum, (m_reg.scan_pointnum)); |
|
|
@ -184,15 +228,36 @@ int32_t OpticalModuleV2::module_get_reg(int32_t regindex, int32_t* val) { |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_reverse_scan_pos_offset, (m_reg.t_reverse_scan_pos_offset)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_reverse_scan_pos_offset, (m_reg.f_reverse_scan_pos_offset)); |
|
|
|
|
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_vdefault, (m_reg.scan_vdefault)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_vstart, (m_reg.scan_vstart)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_a1, (m_reg.scan_a1)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_amax, (m_reg.scan_amax)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_v1, (m_reg.scan_v1)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_dmax, (m_reg.scan_dmax)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_d1, (m_reg.scan_d1)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_vstop, (m_reg.scan_vstop)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_tzerowait, (m_reg.scan_tzerowait)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_vdefault, m_reg.f_scan_vdefault); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_vstart, m_reg.f_scan_vstart); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_a1, m_reg.f_scan_a1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_amax, m_reg.f_scan_amax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_v1, m_reg.f_scan_v1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_dmax, m_reg.f_scan_dmax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_d1, m_reg.f_scan_d1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_vstop, m_reg.f_scan_vstop); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_tzerowait, m_reg.f_scan_tzerowait); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_f_scan_irun, m_reg.f_scan_irun); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_vdefault, m_reg.t_scan_vdefault); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_vstart, m_reg.t_scan_vstart); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_a1, m_reg.t_scan_a1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_amax, m_reg.t_scan_amax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_v1, m_reg.t_scan_v1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_dmax, m_reg.t_scan_dmax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_d1, m_reg.t_scan_d1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_vstop, m_reg.t_scan_vstop); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_tzerowait, m_reg.t_scan_tzerowait); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_t_scan_irun, m_reg.t_scan_irun); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_vdefault, m_reg.barcode_scan_vdefault); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_vstart, m_reg.barcode_scan_vstart); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_a1, m_reg.barcode_scan_a1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_amax, m_reg.barcode_scan_amax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_v1, m_reg.barcode_scan_v1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_dmax, m_reg.barcode_scan_dmax); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_d1, m_reg.barcode_scan_d1); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_vstop, m_reg.barcode_scan_vstop); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_tzerowait, m_reg.barcode_scan_tzerowait); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_barcode_scan_irun, m_reg.barcode_scan_irun); |
|
|
|
|
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_step_interval, (m_reg.scan_step_interval)); |
|
|
|
MODULE_CFG_CASE__GET_REG_FROM(kreg_a8k_opt_scan_pointnum, (m_reg.scan_pointnum)); |
|
|
@ -204,7 +269,6 @@ int32_t OpticalModuleV2::module_get_reg(int32_t regindex, int32_t* val) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int32_t OpticalModuleV2::module_stop() { |
|
|
|
m_thread.stop(); |
|
|
|
return 0; |
|
|
@ -228,7 +292,7 @@ int32_t OpticalModuleV2::start_t_optical_scan(int32_t scanDirection, int32_t las |
|
|
|
scanStartPos = m_reg.t_reverse_scan_pos_offset; |
|
|
|
} |
|
|
|
active_motor_default_cfg(); |
|
|
|
move_to_block(scanStartPos); |
|
|
|
move_to_block(knormal_run, scanStartPos); |
|
|
|
|
|
|
|
// 设置激光亮度增益
|
|
|
|
a8000_optical_set_laster_gain(kt_optical, lasterGain); |
|
|
@ -245,10 +309,10 @@ int32_t OpticalModuleV2::start_t_optical_scan(int32_t scanDirection, int32_t las |
|
|
|
adc_capture_point_num = 0; |
|
|
|
|
|
|
|
int32_t startTicket = HAL_GetTick(); |
|
|
|
active_motor_opt_cfg(); |
|
|
|
active_motor_opt_cfg(kt_optical); |
|
|
|
while (true) { |
|
|
|
// 移动到第一个点
|
|
|
|
move_to_block(scanStartPos + step); |
|
|
|
move_to_block(kt_optical, scanStartPos + step); |
|
|
|
// osDelay(1);
|
|
|
|
t_read_one_point(adcval); |
|
|
|
|
|
|
@ -299,7 +363,7 @@ int32_t OpticalModuleV2::start_f_optical_scan(int32_t scanDirection, int32_t las |
|
|
|
scanStartPos = m_reg.f_reverse_scan_pos_offset; |
|
|
|
} |
|
|
|
active_motor_default_cfg(); |
|
|
|
move_to_block(scanStartPos); |
|
|
|
move_to_block(knormal_run, scanStartPos); |
|
|
|
|
|
|
|
// 设置激光亮度增益
|
|
|
|
a8000_optical_set_laster_gain(kf_optical, lasterGain); |
|
|
@ -318,11 +382,11 @@ int32_t OpticalModuleV2::start_f_optical_scan(int32_t scanDirection, int32_t las |
|
|
|
int pointnum = 0; |
|
|
|
int32_t adcval = 0; |
|
|
|
adc_capture_point_num = 0; |
|
|
|
active_motor_opt_cfg(); |
|
|
|
active_motor_opt_cfg(kf_optical); |
|
|
|
int32_t startTicket = HAL_GetTick(); |
|
|
|
while (true) { |
|
|
|
// 移动到第一个点
|
|
|
|
move_to_block(scanStartPos + step); |
|
|
|
move_to_block(kf_optical, scanStartPos + step); |
|
|
|
f_read_one_point(lasterGain, scanGain, adcval); |
|
|
|
|
|
|
|
step += intervalStep; |
|
|
@ -373,7 +437,7 @@ int32_t OpticalModuleV2::start_barcode_scan(int32_t lasterGain, int32_t scanGain |
|
|
|
|
|
|
|
osDelay(10); |
|
|
|
active_motor_default_cfg(); |
|
|
|
move_to_block(startpos); |
|
|
|
move_to_block(knormal_run, startpos); |
|
|
|
|
|
|
|
// 设置激光亮度增益
|
|
|
|
a8000_optical_set_laster_gain(kf_optical, lasterGain); |
|
|
@ -394,11 +458,11 @@ int32_t OpticalModuleV2::start_barcode_scan(int32_t lasterGain, int32_t scanGain |
|
|
|
adc_capture_point_num = 0; |
|
|
|
int32_t scanDirection = intervalstep < 0 ? 1 : 0; // 与电机运行相反的方向为正
|
|
|
|
|
|
|
|
active_motor_opt_cfg(); |
|
|
|
active_motor_opt_cfg(kbarcode_optical); |
|
|
|
int32_t startTicket = HAL_GetTick(); |
|
|
|
while (true) { |
|
|
|
// 移动到第一个点
|
|
|
|
move_to_block(startpos + step); |
|
|
|
move_to_block(kbarcode_optical, startpos + step); |
|
|
|
f_read_one_point(lasterGain, scanGain, adcval); |
|
|
|
|
|
|
|
step += intervalstep; |
|
|
@ -639,21 +703,54 @@ int32_t OpticalModuleV2::_close_t_amp_n5v() { |
|
|
|
void OpticalModuleV2::active_motor_default_cfg() { motor->step_motor_active_cfg(); } |
|
|
|
void OpticalModuleV2::recover_motor_default_cfg() { active_motor_default_cfg(); } |
|
|
|
|
|
|
|
void OpticalModuleV2::active_motor_opt_cfg() { |
|
|
|
void OpticalModuleV2::active_motor_opt_cfg(optical_type_t optType) { |
|
|
|
auto _motor = motor->getMotor(); |
|
|
|
_motor->set_vstart(m_reg.scan_vstart); |
|
|
|
_motor->set_vstop(m_reg.scan_vstop); |
|
|
|
_motor->set_a1(m_reg.scan_a1); |
|
|
|
_motor->set_d1(m_reg.scan_d1); |
|
|
|
_motor->set_v1(m_reg.scan_v1); |
|
|
|
_motor->set_amax(m_reg.scan_amax); |
|
|
|
_motor->set_dmax(m_reg.scan_dmax); |
|
|
|
_motor->set_tzerowait(m_reg.scan_tzerowait); |
|
|
|
if (optType == kf_optical) { |
|
|
|
_motor->set_vstart(m_reg.f_scan_vstart); |
|
|
|
_motor->set_vstop(m_reg.f_scan_vstop); |
|
|
|
_motor->set_a1(m_reg.f_scan_a1); |
|
|
|
_motor->set_d1(m_reg.f_scan_d1); |
|
|
|
_motor->set_v1(m_reg.f_scan_v1); |
|
|
|
_motor->set_amax(m_reg.f_scan_amax); |
|
|
|
_motor->set_dmax(m_reg.f_scan_dmax); |
|
|
|
_motor->set_tzerowait(m_reg.f_scan_tzerowait); |
|
|
|
_motor->setIHOLD_IRUN(m_reg.f_scan_irun, m_reg.f_scan_irun, 1000); |
|
|
|
} else if (optType == kt_optical) { |
|
|
|
_motor->set_vstart(m_reg.t_scan_vstart); |
|
|
|
_motor->set_vstop(m_reg.t_scan_vstop); |
|
|
|
_motor->set_a1(m_reg.t_scan_a1); |
|
|
|
_motor->set_d1(m_reg.t_scan_d1); |
|
|
|
_motor->set_v1(m_reg.t_scan_v1); |
|
|
|
_motor->set_amax(m_reg.t_scan_amax); |
|
|
|
_motor->set_dmax(m_reg.t_scan_dmax); |
|
|
|
_motor->set_tzerowait(m_reg.t_scan_tzerowait); |
|
|
|
_motor->setIHOLD_IRUN(m_reg.t_scan_irun, m_reg.t_scan_irun, 1000); |
|
|
|
} else if (optType == kbarcode_optical) { |
|
|
|
_motor->set_vstart(m_reg.barcode_scan_vstart); |
|
|
|
_motor->set_vstop(m_reg.barcode_scan_vstop); |
|
|
|
_motor->set_a1(m_reg.barcode_scan_a1); |
|
|
|
_motor->set_d1(m_reg.barcode_scan_d1); |
|
|
|
_motor->set_v1(m_reg.barcode_scan_v1); |
|
|
|
_motor->set_amax(m_reg.barcode_scan_amax); |
|
|
|
_motor->set_dmax(m_reg.barcode_scan_dmax); |
|
|
|
_motor->set_tzerowait(m_reg.barcode_scan_tzerowait); |
|
|
|
_motor->setIHOLD_IRUN(m_reg.barcode_scan_irun, m_reg.barcode_scan_irun, 1000); |
|
|
|
} else { |
|
|
|
active_motor_default_cfg(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int32_t OpticalModuleV2::move_to_block(int32_t pos) { |
|
|
|
int32_t OpticalModuleV2::move_to_block(optical_type_t optType, int32_t pos) { |
|
|
|
auto _motor = motor->getMotor(); |
|
|
|
_motor->moveTo(pos, m_reg.scan_vdefault); |
|
|
|
if (optType == kf_optical) { |
|
|
|
_motor->moveTo(pos, m_reg.f_scan_vdefault); |
|
|
|
} else if (optType == kt_optical) { |
|
|
|
_motor->moveTo(pos, m_reg.t_scan_vdefault); |
|
|
|
} else if (optType == kbarcode_optical) { |
|
|
|
_motor->moveTo(pos, m_reg.barcode_scan_vdefault); |
|
|
|
} else { |
|
|
|
_motor->moveTo(pos, motor->getCfg()->motor_default_velocity); |
|
|
|
} |
|
|
|
while (!_motor->isReachTarget()) { |
|
|
|
} |
|
|
|
return 0; |
|
|
|