Browse Source

update

master
zhaohe 2 years ago
parent
commit
a42585f094
  1. 5
      components/iflytop_can_slave_module_master_end/stepmotor.cpp
  2. 2
      components/iflytop_can_slave_module_master_end/stepmotor.hpp

5
components/iflytop_can_slave_module_master_end/stepmotor.cpp

@ -79,12 +79,13 @@ bool StepMotor::moveBy(int32_t pos) { //
}
return m_canMaster->writeReg(m_id, m_baseCtrlPoint + SAMC_REG_ACT_MOVE_BY, pos, 20);
}
bool StepMotor::rotate(int32_t velocity) { //
bool StepMotor::rotate(int32_t direction) { //
if (m_fakeMotorl) {
ZLOGE(TAG, "call stepmotor fail,motor is null");
return false;
}
return m_canMaster->writeReg(m_id, m_baseCtrlPoint + SAMC_REG_ACT_ROTATE, velocity, 20);
ZLOGI(TAG, "rotate %d", direction);
return m_canMaster->writeReg(m_id, m_baseCtrlPoint + SAMC_REG_ACT_ROTATE, direction, 20);
}
int32_t StepMotor::getPos() {
if (m_fakeMotorl) {

2
components/iflytop_can_slave_module_master_end/stepmotor.hpp

@ -32,7 +32,7 @@ class StepMotor {
bool setDec(int32_t dec);
bool moveTo(int32_t pos);
bool moveBy(int32_t pos);
bool rotate(int32_t velocity);
bool rotate(int32_t direction);
void clearException();

Loading…
Cancel
Save