Browse Source

update

master
zhaohe 2 years ago
parent
commit
8f364e5f9d
  1. 6
      components/tmc/ic/ztmc4361A.cpp
  2. 4
      components/tmc/ic/ztmc4361A.hpp
  3. 2
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

6
components/tmc/ic/ztmc4361A.cpp

@ -380,6 +380,12 @@ uint32_t TMC4361A::driverIC_readICVersion() {
}
void TMC4361A::driverIC_setIHOLD_IRUN(uint8_t ihold, uint8_t irun, uint16_t iholddelay) { driverIC_writeInt(TMC2160_IHOLD_IRUN, (iholddelay << TMC2160_IHOLDDELAY_SHIFT) | (irun << TMC2160_IRUN_SHIFT) | (ihold << TMC2160_IHOLD_SHIFT)); }
void TMC4361A::setGLOBAL_SCALER(int32_t value) {
if (value > 255) value = 255;
if (value != 0 && value < 32) value = 32;
driverIC_writeInt(TMC2160_GLOBAL_SCALER, value);
}
// Left Virtual Limit Switch XACTUAL ¡Ü VIRT_STOP_LEFT ʱ´¥·¢
void TMC4361A::setLeftVirtualLimitSwitch(bool enable, int32_t position) {
PRV_FIELD_WRITE(TMC4361A_REFERENCE_CONF, TMC4361A_VIRTUAL_LEFT_LIMIT_EN_MASK, TMC4361A_VIRTUAL_LEFT_LIMIT_EN_SHIFT, enable ? 1 : 0);

4
components/tmc/ic/ztmc4361A.hpp

@ -117,6 +117,9 @@ class TMC4361A : public IStepperMotor {
virtual void setIHOLD_IRUN(uint8_t ihold, uint8_t irun, uint16_t iholddelay) { driverIC_setIHOLD_IRUN(ihold, irun, iholddelay); }
virtual void setMotorShaft(bool reverse) { driverIC_setMotorShaft(reverse); }
//????????????
void setGLOBAL_SCALER(int32_t value);
virtual void setScale(int32_t scale);
virtual void setScaleDenominator(int32_t scale);
@ -148,6 +151,7 @@ class TMC4361A : public IStepperMotor {
int32_t readInt(uint8_t address);
void readWriteCover(uint8_t *data, size_t length);
void writeSubRegister(uint8_t address, uint32_t mask, uint32_t shift, uint32_t value);
// ????????????
int32_t getENC_POS_DEV(); // ENC_POSºÍXACTUALµÄÆ«²î
uint32_t readEVENTS(); // ¶Áȡʼþ¼Ä´æ

2
components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

@ -37,6 +37,8 @@ void XYRobotCtrlModule::initialize(int32_t id, IStepperMotor* stepM1, IStepperMo
m_cfg = m_default_cfg;
}
active_cfg();
m_stepM1->setScaleDenominator(10);
m_stepM2->setScaleDenominator(10);
enable(true);
m_thread.init("XYRobotCtrlModule", 1024, osPriorityNormal);
}

Loading…
Cancel
Save