Browse Source

调整TMC5130速度配置接口

master
zhaohe 2 months ago
parent
commit
b08a126ec4
  1. 3
      sdk/components/pipette_module/base/pipette_cfg.hpp
  2. 43
      sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  3. 33
      sdk/components/tmc/basic/tmc_ic_interface.hpp
  4. 54
      sdk/components/tmc/ic/ztmc5130.cpp
  5. 30
      sdk/components/tmc/ic/ztmc5130.hpp
  6. 63
      sdk/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
  7. 106
      sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp
  8. 16
      sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp
  9. 0
      usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.cpp.bak
  10. 0
      usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.hpp.bak
  11. 15
      usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.cpp
  12. 62
      usrc/subboards/subboard90_optical_module/optical_module_v2.cpp

3
sdk/components/pipette_module/base/pipette_cfg.hpp

@ -50,6 +50,7 @@ typedef struct {
int32_t tip_picking_pos; // 开始取tip位置(绝对位置0.1mm)
int32_t tip_picking_search_range; // 取tip的范围
int32_t tip_picking_append_distance; // 取tip时z轴的附加距离
int32_t tip_picking_settling_time; // 取tip后的保持时间(ms)
int32_t tip_deposit_pos; // 丢tip位置(绝对位置0.1mm)
int32_t _transform_pos; // 移液枪安全移动的高度(绝对位置0.1mm)
@ -72,6 +73,7 @@ typedef enum {
kplatinfo_tip_picking_pos,
kplatinfo_tip_picking_search_range,
kplatinfo_tip_picking_append_distance,
kplatinfo_tip_picking_settling_time,
kplatinfo_tip_deposit_pos,
kplatinfo_transform_pos,
kplatinfo_tip_type,
@ -85,6 +87,7 @@ static inline const char *platinfo_index_to_string(platinfo_index_t index) {
CASE_ENUM_TO_STRING(kplatinfo_tip_picking_pos)
CASE_ENUM_TO_STRING(kplatinfo_tip_picking_search_range)
CASE_ENUM_TO_STRING(kplatinfo_tip_picking_append_distance)
CASE_ENUM_TO_STRING(kplatinfo_tip_picking_settling_time)
CASE_ENUM_TO_STRING(kplatinfo_tip_deposit_pos)
CASE_ENUM_TO_STRING(kplatinfo_transform_pos)
CASE_ENUM_TO_STRING(kplatinfo_tip_type)

43
sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -259,17 +259,20 @@ int32_t StepMotorCtrlModule::step_motor_active_cfg() {
m_stepM1->setScaleDenominator(m_cfg.motor_one_circle_pulse_denominator);
m_stepM1->setMotorShaft(m_cfg.motor_shaft);
m_stepM1->setGlobalScale(m_cfg.stepmotor_iglobalscaler);
m_stepM1->set_vstart(m_cfg.motor_vstart);
m_stepM1->set_a1(m_cfg.motor_a1);
m_stepM1->set_amax(m_cfg.motor_amax);
m_stepM1->set_v1(m_cfg.motor_v1);
m_stepM1->set_dmax(m_cfg.motor_dmax);
m_stepM1->set_d1(m_cfg.motor_d1);
m_stepM1->set_vstop(m_cfg.motor_vstop);
m_stepM1->set_tzerowait(m_cfg.motor_tzerowait);
m_stepM1->set_enc_resolution(m_cfg.motor_enc_resolution);
TMC51X0::VCfg_t vcfg;
vcfg.a1 = m_cfg.motor_a1;
vcfg.amax = m_cfg.motor_amax;
vcfg.v1 = m_cfg.motor_v1;
vcfg.dmax = m_cfg.motor_dmax;
vcfg.d1 = m_cfg.motor_d1;
vcfg.vstart = m_cfg.motor_vstart;
vcfg.vstop = m_cfg.motor_vstop;
vcfg.vmax = m_cfg.motor_default_velocity;
m_stepM1->set_vcfg(&vcfg);
// stepmotor_iglobalscaler
if (m_state.enable) {
m_stepM1->enable(true);
@ -898,12 +901,32 @@ int32_t StepMotorCtrlModule::setnowpos(int32_t x) {
}
int32_t StepMotorCtrlModule::moveTo(int32_t x, int32_t v) {
trysyncpos();
m_stepM1->moveTo(x, v);
TMC51X0::VCfg_t vcfg;
vcfg.a1 = m_cfg.motor_a1;
vcfg.amax = m_cfg.motor_amax;
vcfg.v1 = m_cfg.motor_v1;
vcfg.dmax = m_cfg.motor_dmax;
vcfg.d1 = m_cfg.motor_d1;
vcfg.vstart = m_cfg.motor_vstart;
vcfg.vstop = m_cfg.motor_vstop;
vcfg.vmax = v;
m_stepM1->set_vcfg(&vcfg);
m_stepM1->moveTo(x);
return 0;
}
int32_t StepMotorCtrlModule::rotate(int32_t direction, int32_t v) {
trysyncpos();
m_stepM1->moveToEnd(direction, v);
TMC51X0::VCfg_t vcfg;
vcfg.a1 = m_cfg.motor_a1;
vcfg.amax = m_cfg.motor_amax;
vcfg.v1 = m_cfg.motor_v1;
vcfg.dmax = m_cfg.motor_dmax;
vcfg.d1 = m_cfg.motor_d1;
vcfg.vstart = m_cfg.motor_vstart;
vcfg.vstop = m_cfg.motor_vstop;
vcfg.vmax = v;
m_stepM1->set_vcfg(&vcfg);
m_stepM1->moveToEnd(direction);
return 0;
}
int32_t StepMotorCtrlModule::rotateInVelocityMode(int32_t v) {

33
sdk/components/tmc/basic/tmc_ic_interface.hpp

@ -23,37 +23,4 @@ typedef enum {
// kTMC5160 = 0x30,
} tmcic_id_t;
class IStepperMotor {
public:
IStepperMotor() {}
virtual ~IStepperMotor() {}
virtual void enable(bool enable) = 0;
virtual void rotate(int32_t velocity) = 0;
virtual void moveTo(int32_t position, uint32_t velocityMax) = 0;
virtual void moveBy(int32_t relativePosition, uint32_t velocityMax) = 0;
virtual void stop() = 0;
virtual void setXACTUAL(int32_t value) = 0; // 设置当前位置
virtual int32_t getXACTUAL() = 0; // 当前位置
virtual int32_t getVACTUAL() = 0; // 当前速度
virtual void setAcceleration(float accelerationpps2) = 0; // 设置最大加速度
virtual void setDeceleration(float accelerationpps2) = 0; // 设置最大减速度
virtual void setMotorShaft(bool reverse) = 0;
virtual void setIHOLD_IRUN(uint8_t ihold, uint8_t irun, uint16_t iholddelay) = 0;
virtual void setGlobalScale(uint8_t globalscale) = 0;
virtual void setScale(int32_t scale) = 0;
virtual void setScaleDenominator(int32_t scale) = 0;
virtual bool isReachTarget() = 0; // 是否到达目标位置
virtual bool isStoped() = 0; // 是否停止运动
virtual void setNoAccLimit(bool enable) = 0;
};
} // namespace iflytop

54
sdk/components/tmc/ic/ztmc5130.cpp

@ -257,34 +257,34 @@ void TMC51X0::rotate(int32_t velocity) {
writeInt(TMC5130_VMAX, abs(velocity));
writeInt(TMC5130_RAMPMODE, (velocity >= 0) ? TMC5130_MODE_VELPOS : TMC5130_MODE_VELNEG);
}
void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) {
// position *= m_scale;
// velocityMax *= m_scale;
position = to_motor_pos(position);
velocityMax = to_motor_vel(velocityMax);
// ZLOGI("TMC5130", "moveTo %d %d", position, velocityMax);
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
writeInt(TMC5130_VMAX, velocityMax);
writeInt(TMC5130_XTARGET, position);
}
void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) {
ZLOGI("TMC5130", "moveToEnd %d %d", direction, velocityMax);
if (direction > 0) {
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
writeInt(TMC5130_XTARGET, INT32_MAX / 2 - 1000);
} else {
writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
writeInt(TMC5130_XTARGET, INT32_MIN / 2 + 1000);
}
}
// void TMC51X0::moveTo(int32_t position, uint32_t velocityMax) {
// // position *= m_scale;
// // velocityMax *= m_scale;
// position = to_motor_pos(position);
// velocityMax = to_motor_vel(velocityMax);
// // ZLOGI("TMC5130", "moveTo %d %d", position, velocityMax);
// writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
// writeInt(TMC5130_VMAX, velocityMax);
// writeInt(TMC5130_XTARGET, position);
// }
// void TMC51X0::moveToEnd(int32_t direction, uint32_t velocityMax) {
// ZLOGI("TMC5130", "moveToEnd %d %d", direction, velocityMax);
// if (direction > 0) {
// writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
// writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
// writeInt(TMC5130_XTARGET, INT32_MAX / 2 - 1000);
// } else {
// writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION);
// writeInt(TMC5130_VMAX, to_motor_vel(velocityMax));
// writeInt(TMC5130_XTARGET, INT32_MIN / 2 + 1000);
// }
// }
void TMC51X0::moveBy(int32_t relativePosition, uint32_t velocityMax) { // determine actual position and add numbers of ticks to move
int32_t pos = getXACTUAL();
int32_t target = pos + relativePosition;
moveTo(target, velocityMax);
}
// void TMC51X0::moveBy(int32_t relativePosition, uint32_t velocityMax) { // determine actual position and add numbers of ticks to move
// int32_t pos = getXACTUAL();
// int32_t target = pos + relativePosition;
// moveTo(target, velocityMax);
// }
void TMC51X0::rotateDirection(int32_t direction) { writeInt(TMC5130_RAMPMODE, (direction >= 0) ? TMC5130_MODE_VELPOS : TMC5130_MODE_VELNEG); }
void TMC51X0::moveTo(int32_t position) {

30
sdk/components/tmc/ic/ztmc5130.hpp

@ -62,7 +62,7 @@ class Tmc5130RampStat {
bool isSetted(ramp_stat_bit_t bit) { return (m_state & bit) != 0; }
};
class TMC51X0 : public IStepperMotor {
class TMC51X0 {
public:
typedef struct {
uint32_t sg_result : 10;
@ -138,9 +138,9 @@ class TMC51X0 : public IStepperMotor {
virtual void enable(bool enable);
virtual void rotate(int32_t velocity);
virtual void moveTo(int32_t position, uint32_t velocityMax);
virtual void moveToEnd(int32_t direction, uint32_t velocityMax);
virtual void moveBy(int32_t relativePosition, uint32_t velocityMax);
// virtual void moveTo(int32_t position, uint32_t velocityMax);
// virtual void moveToEnd(int32_t direction, uint32_t velocityMax);
// virtual void moveBy(int32_t relativePosition, uint32_t velocityMax);
virtual void rotateDirection(int32_t direction);
virtual void moveTo(int32_t position);
@ -171,17 +171,7 @@ class TMC51X0 : public IStepperMotor {
virtual bool isReachTarget(); // 是否到达目标位置
virtual bool isStoped() { return isReachTarget(); }
virtual void setNoAccLimit(bool enable) override;
virtual void set_vstart(int32_t val);
virtual void set_a1(int32_t val);
virtual void set_amax(int32_t val);
virtual void set_v1(int32_t val);
virtual void set_dmax(int32_t val);
virtual void set_d1(int32_t val);
virtual void set_vstop(int32_t val);
virtual void set_tzerowait(int32_t val);
virtual void set_vmax(int32_t vmax);
virtual void setNoAccLimit(bool enable) ;
virtual void set_vcfg(VCfg_t *vcfg);
@ -221,6 +211,7 @@ class TMC51X0 : public IStepperMotor {
void writeInt(uint8_t address, int32_t value);
int32_t readInt(uint8_t address);
void setMRES(mres_type_t value);
virtual void set_tzerowait(int32_t val);
private:
uint32_t haspassedms(uint32_t now, uint32_t last);
@ -231,6 +222,15 @@ class TMC51X0 : public IStepperMotor {
int32_t to_user_pos(int32_t pos); //
int32_t to_user_vel(int32_t vel);
virtual void set_vstart(int32_t val);
virtual void set_a1(int32_t val);
virtual void set_amax(int32_t val);
virtual void set_v1(int32_t val);
virtual void set_dmax(int32_t val);
virtual void set_d1(int32_t val);
virtual void set_vstop(int32_t val);
virtual void set_vmax(int32_t vmax);
};
} // namespace iflytop
#endif

63
sdk/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

@ -90,13 +90,13 @@ int32_t XYRobotCtrlModule::module_active_cfg() {
m_stepM1->setGlobalScale(m_cfg.iglobalscaler);
m_stepM1->setScale(m_cfg.one_circle_pulse / 2);
m_stepM1->setScaleDenominator(m_cfg.one_circle_pulse_denominator);
m_stepM1->set_vstart(m_cfg.vstart);
m_stepM1->set_a1(m_cfg.a1);
m_stepM1->set_amax(m_cfg.amax);
m_stepM1->set_v1(m_cfg.v1);
m_stepM1->set_dmax(m_cfg.dmax);
m_stepM1->set_d1(m_cfg.d1);
m_stepM1->set_vstop(m_cfg.vstop);
// m_stepM1->set_vstart(m_cfg.vstart);
// m_stepM1->set_a1(m_cfg.a1);
// m_stepM1->set_amax(m_cfg.amax);
// m_stepM1->set_v1(m_cfg.v1);
// m_stepM1->set_dmax(m_cfg.dmax);
// m_stepM1->set_d1(m_cfg.d1);
// m_stepM1->set_vstop(m_cfg.vstop);
m_stepM1->set_tzerowait(m_cfg.tzerowait);
m_stepM1->set_enc_resolution(m_cfg.enc_resolution);
@ -104,13 +104,13 @@ int32_t XYRobotCtrlModule::module_active_cfg() {
m_stepM2->setGlobalScale(m_cfg.iglobalscaler);
m_stepM2->setScale(m_cfg.one_circle_pulse / 2);
m_stepM2->setScaleDenominator(m_cfg.one_circle_pulse_denominator);
m_stepM2->set_vstart(m_cfg.vstart);
m_stepM2->set_a1(m_cfg.a1);
m_stepM2->set_amax(m_cfg.amax);
m_stepM2->set_v1(m_cfg.v1);
m_stepM2->set_dmax(m_cfg.dmax);
m_stepM2->set_d1(m_cfg.d1);
m_stepM2->set_vstop(m_cfg.vstop);
// m_stepM2->set_vstart(m_cfg.vstart);
// m_stepM2->set_a1(m_cfg.a1);
// m_stepM2->set_amax(m_cfg.amax);
// m_stepM2->set_v1(m_cfg.v1);
// m_stepM2->set_dmax(m_cfg.dmax);
// m_stepM2->set_d1(m_cfg.d1);
// m_stepM2->set_vstop(m_cfg.vstop);
m_stepM2->set_tzerowait(m_cfg.tzerowait);
m_stepM2->set_enc_resolution(m_cfg.enc_resolution);
@ -560,8 +560,21 @@ void XYRobotCtrlModule::moveTo(int32_t t_x, int32_t t_y, int32_t v) {
int32_t target_m1pos, target_m2pos;
forward_kinematics(t_x, t_y, target_m1pos, target_m2pos);
ZLOGI(TAG, "moveTo x:%d y:%d m1:%d m2:%d v:%d", t_x, t_y, target_m1pos, target_m2pos, v);
m_stepM1->moveTo(target_m1pos, v);
m_stepM2->moveTo(target_m2pos, v);
TMC51X0::VCfg_t vcfg;
vcfg.a1 = m_cfg.a1;
vcfg.amax = m_cfg.amax;
vcfg.v1 = m_cfg.v1;
vcfg.dmax = m_cfg.dmax;
vcfg.d1 = m_cfg.d1;
vcfg.vstart = m_cfg.vstart;
vcfg.vstop = m_cfg.vstop;
vcfg.vmax = v;
m_stepM1->set_vcfg(&vcfg);
m_stepM2->set_vcfg(&vcfg);
m_stepM1->moveTo(target_m1pos);
m_stepM2->moveTo(target_m2pos);
}
void XYRobotCtrlModule::moveBy(int32_t dx, int32_t dy, int32_t v) {
int32_t x, y;
@ -585,8 +598,22 @@ int32_t XYRobotCtrlModule::xymotor_set_pos(int32_t x, int32_t y) {
}
int32_t XYRobotCtrlModule::xymotor_motor_move_by_direct(int32_t motor1_dpos, int32_t motor2_dpos) {
m_stepM1->moveBy(motor1_dpos, m_cfg.default_velocity);
m_stepM2->moveBy(motor2_dpos, m_cfg.default_velocity);
TMC51X0::VCfg_t vcfg;
vcfg.a1 = m_cfg.a1;
vcfg.amax = m_cfg.amax;
vcfg.v1 = m_cfg.v1;
vcfg.dmax = m_cfg.dmax;
vcfg.d1 = m_cfg.d1;
vcfg.vstart = m_cfg.vstart;
vcfg.vstop = m_cfg.vstop;
vcfg.vmax = m_cfg.default_velocity;
m_stepM1->set_vcfg(&vcfg);
m_stepM2->set_vcfg(&vcfg);
m_stepM1->moveBy(motor1_dpos);
m_stepM2->moveBy(motor2_dpos);
return 0;
}
int32_t XYRobotCtrlModule::xymotor_read_enc_direct(int32_t* enc1, int32_t* enc2) {

106
sdk/components/zcan_protocol_parser/zcan_protocol_parser.cpp

@ -12,7 +12,7 @@
#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module.hpp"
#include "sdk\components\xy_robot_ctrl_module\xy_robot_ctrl_module.hpp"
#include "subboards\subboard100_idcard_reader\eeprom_service.hpp"
#include "subboards\subboard20_plate_clamp_case\plate_code_scaner_module.hpp"
// #include "subboards\subboard20_plate_clamp_case\plate_code_scaner_module.hpp"
#include "subboards\subboard40_and_50_temperature_ctrl\zcan_fan_ctrl_module.hpp"
#include "subboards\subboard90_optical_module\optical_module_v2.hpp"
//
@ -140,14 +140,14 @@ void ZCanProtocolParser::initialize(ZCanReceiver* cancmder) {
REGFN(a8000_idcard_erase);
REGFN(a8000_idcard_earse_unlock);
REGFN(plate_code_scaner_push_card_and_scan);
REGFN(plate_code_scaner_stop_scan);
REGFN(plate_code_scaner_read_result);
REGFN(plate_code_scaner_read_result_point_num);
REGFN(plate_code_scaner_read_code);
REGFN(plate_code_scaner_adc_readraw);
REGFN(plate_code_scaner_open_laser);
REGFN(plate_code_scaner_close_laser);
// REGFN(plate_code_scaner_push_card_and_scan);
// REGFN(plate_code_scaner_stop_scan);
// REGFN(plate_code_scaner_read_result);
// REGFN(plate_code_scaner_read_result_point_num);
// REGFN(plate_code_scaner_read_code);
// REGFN(plate_code_scaner_adc_readraw);
// REGFN(plate_code_scaner_open_laser);
// REGFN(plate_code_scaner_close_laser);
REGFN(pipette_set_zmbcfg);
REGFN(pipette_get_zmbcfg);
@ -858,58 +858,58 @@ int32_t ZCanProtocolParser::a8000_idcard_earse_unlock(cmdcontxt_t* cxt) {
#undef MODULE_CLASS
#define MODULE_CLASS PlateCodeScanerModule
int32_t ZCanProtocolParser::plate_code_scaner_push_card_and_scan(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(1);
return module->plate_code_scaner_push_card_and_scan(cxt->params[0]);
}
// #define MODULE_CLASS PlateCodeScanerModule
// int32_t ZCanProtocolParser::plate_code_scaner_push_card_and_scan(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(1);
// return module->plate_code_scaner_push_card_and_scan(cxt->params[0]);
// }
int32_t ZCanProtocolParser::plate_code_scaner_stop_scan(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
return module->plate_code_scaner_stop_scan();
}
// int32_t ZCanProtocolParser::plate_code_scaner_stop_scan(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// return module->plate_code_scaner_stop_scan();
// }
int32_t ZCanProtocolParser::plate_code_scaner_read_result(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(1);
cxt->acklen = ZCANCMD_PACKET_MAX_LEN;
int32_t suc = module->plate_code_scaner_read_result(cxt->params[0], cxt->ackbuf, &cxt->acklen);
if (suc != 0) {
cxt->acklen = 0;
}
return suc;
}
// int32_t ZCanProtocolParser::plate_code_scaner_read_result(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(1);
// cxt->acklen = ZCANCMD_PACKET_MAX_LEN;
// int32_t suc = module->plate_code_scaner_read_result(cxt->params[0], cxt->ackbuf, &cxt->acklen);
// if (suc != 0) {
// cxt->acklen = 0;
// }
// return suc;
// }
int32_t ZCanProtocolParser::plate_code_scaner_read_result_point_num(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
int32_t* ack = (int32_t*)cxt->ackbuf;
cxt->acklen = 4;
return module->plate_code_scaner_read_result_point_num(&ack[0]);
}
// int32_t ZCanProtocolParser::plate_code_scaner_read_result_point_num(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// int32_t* ack = (int32_t*)cxt->ackbuf;
// cxt->acklen = 4;
// return module->plate_code_scaner_read_result_point_num(&ack[0]);
// }
int32_t ZCanProtocolParser::plate_code_scaner_read_code(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
cxt->acklen = 4 * 4;
return module->plate_code_scaner_read_code(&cxt->params[0], &cxt->params[1], &cxt->params[2], &cxt->params[3]);
}
// int32_t ZCanProtocolParser::plate_code_scaner_read_code(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// cxt->acklen = 4 * 4;
// return module->plate_code_scaner_read_code(&cxt->params[0], &cxt->params[1], &cxt->params[2], &cxt->params[3]);
// }
int32_t ZCanProtocolParser::plate_code_scaner_adc_readraw(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
int32_t* ack = (int32_t*)cxt->ackbuf;
cxt->acklen = 4;
return module->plate_code_scaner_adc_readraw(&ack[0]);
}
// int32_t ZCanProtocolParser::plate_code_scaner_adc_readraw(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// int32_t* ack = (int32_t*)cxt->ackbuf;
// cxt->acklen = 4;
// return module->plate_code_scaner_adc_readraw(&ack[0]);
// }
int32_t ZCanProtocolParser::plate_code_scaner_open_laser(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
return module->plate_code_scaner_open_laser();
}
// int32_t ZCanProtocolParser::plate_code_scaner_open_laser(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// return module->plate_code_scaner_open_laser();
// }
int32_t ZCanProtocolParser::plate_code_scaner_close_laser(cmdcontxt_t* cxt) {
CHECK_AND_GET_MODULE(0);
return module->plate_code_scaner_close_laser();
}
// int32_t ZCanProtocolParser::plate_code_scaner_close_laser(cmdcontxt_t* cxt) {
// CHECK_AND_GET_MODULE(0);
// return module->plate_code_scaner_close_laser();
// }
#undef MODULE_CLASS
// #undef MODULE_CLASS
/***********************************************************************************************************************
* PipetteModuleV2 *

16
sdk/components/zcan_protocol_parser/zcan_protocol_parser.hpp

@ -160,14 +160,14 @@ class ZCanProtocolParser : public IZCanRxProcesser {
CMDFN(a8000_idcard_erase);
CMDFN(a8000_idcard_earse_unlock);
CMDFN(plate_code_scaner_push_card_and_scan);
CMDFN(plate_code_scaner_stop_scan);
CMDFN(plate_code_scaner_read_result);
CMDFN(plate_code_scaner_read_result_point_num);
CMDFN(plate_code_scaner_read_code);
CMDFN(plate_code_scaner_adc_readraw);
CMDFN(plate_code_scaner_open_laser);
CMDFN(plate_code_scaner_close_laser);
// CMDFN(plate_code_scaner_push_card_and_scan);
// CMDFN(plate_code_scaner_stop_scan);
// CMDFN(plate_code_scaner_read_result);
// CMDFN(plate_code_scaner_read_result_point_num);
// CMDFN(plate_code_scaner_read_code);
// CMDFN(plate_code_scaner_adc_readraw);
// CMDFN(plate_code_scaner_open_laser);
// CMDFN(plate_code_scaner_close_laser);
//
CMDFN(pipette_set_zmbcfg);

0
usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.cpp → usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.cpp.bak

0
usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.hpp → usrc/subboards/subboard20_plate_clamp_case/plate_code_scaner_module.hpp.bak

15
usrc/subboards/subboard20_plate_clamp_case/subboard20_plate_clamp_case.cpp

@ -2,7 +2,7 @@
extern "C" {
#include "subboard20_plate_clamp_case_board.h"
}
#include "plate_code_scaner_module.hpp"
// #include "plate_code_scaner_module.hpp"
#include "pri_board.h"
#include "public_service/instance_init.hpp"
#include "public_service/public_service.hpp"
@ -10,7 +10,6 @@ extern "C" {
#include "sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp"
#include "sdk/components/sensors/m3078/m3078_code_scaner.hpp"
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
#define TAG "Subboard20PlateClampCase"
@ -20,7 +19,7 @@ using namespace iflytop;
* IMPL *
***********************************************************************************************************************/
void Subboard20PlateClampCase::initialize() {
module_id = getmoduleId(0);
module_id = getmoduleId(0);
IO_INIT();
GService::inst()->getZCanProtocolParser()->registerModule(this);
@ -32,8 +31,14 @@ void Subboard20PlateClampCase::initialize() {
/***********************************************************************************************************************
* ID1 *
***********************************************************************************************************************/
{ TMC5130_MOTOR_INITER(1, 1); }
{ TMC5130_MOTOR_INITER(2, 2); }
{
TMC5130_MOTOR_INITER(1, 1);
}
{
TMC5130_MOTOR_INITER(2, 2);
}
#endif
#if 0
push_rod_motor = //
dynamic_cast<StepMotorCtrlModule*>(GService::inst()->getZCanProtocolParser()->getModule(getmoduleId(2)));

62
usrc/subboards/subboard90_optical_module/optical_module_v2.cpp

@ -704,35 +704,43 @@ 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(optical_type_t optType) {
auto _motor = motor->getMotor();
auto _motor = motor->getMotor();
TMC51X0::VCfg_t vcfg;
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);
vcfg.vstart = m_reg.f_scan_vstart;
vcfg.vstop = m_reg.f_scan_vstop;
vcfg.a1 = m_reg.f_scan_a1;
vcfg.d1 = m_reg.f_scan_d1;
vcfg.v1 = m_reg.f_scan_v1;
vcfg.amax = m_reg.f_scan_amax;
vcfg.dmax = m_reg.f_scan_dmax;
vcfg.vmax = m_reg.f_scan_vdefault; // 这里的vmax是默认速度
_motor->set_vcfg(&vcfg);
_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);
vcfg.vstart = m_reg.t_scan_vstart;
vcfg.vstop = m_reg.t_scan_vstop;
vcfg.a1 = m_reg.t_scan_a1;
vcfg.d1 = m_reg.t_scan_d1;
vcfg.v1 = m_reg.t_scan_v1;
vcfg.amax = m_reg.t_scan_amax;
vcfg.dmax = m_reg.t_scan_dmax;
vcfg.vmax = m_reg.t_scan_vdefault; // 这里的vmax是默认速度
_motor->set_vcfg(&vcfg);
_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);
vcfg.vstart = m_reg.barcode_scan_vstart;
vcfg.vstop = m_reg.barcode_scan_vstop;
vcfg.a1 = m_reg.barcode_scan_a1;
vcfg.d1 = m_reg.barcode_scan_d1;
vcfg.v1 = m_reg.barcode_scan_v1;
vcfg.amax = m_reg.barcode_scan_amax;
vcfg.dmax = m_reg.barcode_scan_dmax;
vcfg.vmax = m_reg.barcode_scan_vdefault; // 这里的vmax是默认速度
_motor->set_vcfg(&vcfg);
_motor->set_tzerowait(m_reg.barcode_scan_tzerowait);
_motor->setIHOLD_IRUN(m_reg.barcode_scan_irun, m_reg.barcode_scan_irun, 1000);
} else {
@ -742,15 +750,7 @@ void OpticalModuleV2::active_motor_opt_cfg(optical_type_t optType) {
int32_t OpticalModuleV2::move_to_block(optical_type_t optType, int32_t pos) {
auto _motor = motor->getMotor();
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);
}
_motor->moveTo(pos);
while (!_motor->isReachTarget()) {
}
return 0;

Loading…
Cancel
Save