Browse Source

update

master
zhaohe 1 year ago
parent
commit
ac5dbdd306
  1. 17
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
  2. 1
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.hpp

17
components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

@ -65,6 +65,7 @@ int32_t XYRobotCtrlModule::module_active_cfg() {
m_stepM2->enable(false); m_stepM2->enable(false);
m_stepM1->setIHOLD_IRUN(m_cfg.ihold, m_cfg.irun, m_cfg.iholddelay); m_stepM1->setIHOLD_IRUN(m_cfg.ihold, m_cfg.irun, m_cfg.iholddelay);
m_stepM1->setGlobalScale(m_cfg.iglobalscaler);
m_stepM1->setScale(m_cfg.one_circle_pulse / 2); m_stepM1->setScale(m_cfg.one_circle_pulse / 2);
m_stepM1->setScaleDenominator(m_cfg.one_circle_pulse_denominator); m_stepM1->setScaleDenominator(m_cfg.one_circle_pulse_denominator);
m_stepM1->set_vstart(m_cfg.vstart); m_stepM1->set_vstart(m_cfg.vstart);
@ -78,6 +79,7 @@ int32_t XYRobotCtrlModule::module_active_cfg() {
m_stepM1->set_enc_resolution(m_cfg.enc_resolution); m_stepM1->set_enc_resolution(m_cfg.enc_resolution);
m_stepM2->setIHOLD_IRUN(m_cfg.ihold, m_cfg.irun, m_cfg.iholddelay); m_stepM2->setIHOLD_IRUN(m_cfg.ihold, m_cfg.irun, m_cfg.iholddelay);
m_stepM2->setGlobalScale(m_cfg.iglobalscaler);
m_stepM2->setScale(m_cfg.one_circle_pulse / 2); m_stepM2->setScale(m_cfg.one_circle_pulse / 2);
m_stepM2->setScaleDenominator(m_cfg.one_circle_pulse_denominator); m_stepM2->setScaleDenominator(m_cfg.one_circle_pulse_denominator);
m_stepM2->set_vstart(m_cfg.vstart); m_stepM2->set_vstart(m_cfg.vstart);
@ -149,8 +151,18 @@ int32_t XYRobotCtrlModule::xymotor_read_pos(int32_t* x, int32_t* y) {
} }
#define UPDATE_CFG(key) PROCESS_REG(kreg_xyrobot_##key, REG_GET(m_cfg.key), REG_SET(m_cfg.key)) #define UPDATE_CFG(key) PROCESS_REG(kreg_xyrobot_##key, REG_GET(m_cfg.key), REG_SET(m_cfg.key))
int32_t XYRobotCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val) { int32_t XYRobotCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val) {
int32_t ret = __module_xxx_reg(param_id, read, val);
if (ret != 0) {
return ret;
}
if (!read) {
module_active_cfg();
}
}
int32_t XYRobotCtrlModule::__module_xxx_reg(int32_t param_id, bool read, int32_t& val) {
switch (param_id) { switch (param_id) {
UPDATE_CFG(robot_type); UPDATE_CFG(robot_type);
UPDATE_CFG(one_circle_pulse); UPDATE_CFG(one_circle_pulse);
@ -185,6 +197,7 @@ int32_t XYRobotCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t&
return err::kmodule_not_find_reg; return err::kmodule_not_find_reg;
break; break;
} }
return 0; return 0;
} }
@ -423,7 +436,7 @@ void XYRobotCtrlModule::befor_motor_move() {
creg.module_status = 1; creg.module_status = 1;
creg.module_errorcode = 0; creg.module_errorcode = 0;
module_active_cfg();
// module_active_cfg();
xymotor_enable(1); xymotor_enable(1);
} }
void XYRobotCtrlModule::after_motor_move() { void XYRobotCtrlModule::after_motor_move() {

1
components/xy_robot_ctrl_module/xy_robot_ctrl_module.hpp

@ -86,6 +86,7 @@ class XYRobotCtrlModule : public ZIXYMotor, public ZIModule {
} }
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& val) override; virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& val) override;
int32_t __module_xxx_reg(int32_t param_id, bool read, int32_t& val);
virtual int32_t module_stop() override; virtual int32_t module_stop() override;
virtual int32_t module_active_cfg() override; virtual int32_t module_active_cfg() override;

Loading…
Cancel
Save