diff --git a/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp b/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp index 1ac2061..99e2432 100644 --- a/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -610,7 +610,7 @@ int32_t StepMotorCtrlModule::do_step_motor_easy_rotate(int32_t direction) { befor_motor_move(); { // rotate(direction, m_cfg.motor_default_velocity); - m_stepM1->rotate(direction >= 0 ? m_cfg.motor_default_velocity : -m_cfg.motor_default_velocity); + rotateInVelocityMode(direction >= 0 ? m_cfg.motor_default_velocity : -m_cfg.motor_default_velocity); while (true) { if (m_thread.getExitFlag()) break; @@ -790,9 +790,15 @@ int32_t StepMotorCtrlModule::moveTo(int32_t x, int32_t v) { return 0; } int32_t StepMotorCtrlModule::rotate(int32_t direction, int32_t v) { + trysyncpos(); m_stepM1->moveToEnd(direction, v); return 0; } +int32_t StepMotorCtrlModule::rotateInVelocityMode(int32_t v) { + trysyncpos(); + m_stepM1->rotate(v); + return 0; +} int32_t StepMotorCtrlModule::update_dzero(int32_t dzero) { int32_t now; diff --git a/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp b/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp index 29b0148..0bd57c2 100644 --- a/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp +++ b/sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp @@ -149,6 +149,7 @@ class StepMotorCtrlModule : public ZIModule { int32_t moveTo(int32_t x, int32_t v); int32_t moveBy(int32_t dx, int32_t v); int32_t rotate(int32_t direction, int32_t v); + int32_t rotateInVelocityMode(int32_t v); int32_t update_dzero(int32_t dzero); bool waitforstop(function checkstop, int checkperiod = 20); diff --git a/usrc/version.h b/usrc/version.h index ce840be..3774596 100644 --- a/usrc/version.h +++ b/usrc/version.h @@ -1,2 +1,2 @@ #pragma once -#define PC_VERSION 1010 +#define PC_VERSION 1011