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 49b49f3..d9600be 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 @@ -388,7 +388,9 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio if (direction < 0) { targetpos = getnowpos() - m_cfg.io_trigger_append_distance; } + ZLOGI(TAG, "step4: move to zero point %d", targetpos); moveTo(targetpos, m_cfg.motor_default_velocity); + waitforstop(nullptr); if (m_thread.getExitFlag()) { @@ -670,7 +672,7 @@ int32_t StepMotorCtrlModule::step_motor_easy_move_to_zero_point_quick() { bool moveToZero = false; do { // 期望偏差 - int32_t expectation_dpos = 0 + m_cfg.motor_dzero - getnowpos(); + int32_t expectation_dpos = -m_cfg.io_trigger_append_distance + 0 + m_cfg.motor_dzero - getnowpos(); // 快速移动到零点 moveTo(0 + m_cfg.motor_dzero, m_cfg.motor_default_velocity); // 等待移动到目标点 @@ -683,7 +685,7 @@ int32_t StepMotorCtrlModule::step_motor_easy_move_to_zero_point_quick() { } while (false); after_motor_move(); - if (moveToZero) setnowpos(0 + m_cfg.motor_dzero); + if (moveToZero) setnowpos(0 + m_cfg.motor_dzero - m_cfg.io_trigger_append_distance); }, [this]() { m_stepM1->stop(); }); diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 070203c..1db2dc5 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,5 @@ #pragma once -#define PC_VERSION 512 +#define PC_VERSION 513 #define PC_MANUFACTURER "http://www.iflytop.com/" #define PC_PROJECT_NAME "a8000_subboard" #define PC_IFLYTOP_ENABLE_OS 1