From 52e7363a405fa4ae5f6550f61cc69724a13cf25b Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 26 Jul 2024 09:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BF=AB=E9=80=9F=E5=BD=92?= =?UTF-8?q?=E9=9B=B6=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step_motor_ctrl_module/step_motor_ctrl_module.cpp | 15 +++++++++++---- usrc/project_configs.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) 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 d9600be..506ac63 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 @@ -673,10 +673,17 @@ int32_t StepMotorCtrlModule::step_motor_easy_move_to_zero_point_quick() { do { // 期望偏差 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); - // 等待移动到目标点 - if (!waitforstop([this]() { return m_iotable[0].getState(); })) break; + if (!m_iotable[0].getState()) { + // 快速移动到零点 + moveTo(0 + m_cfg.motor_dzero, m_cfg.motor_default_velocity); + // 等待移动到目标点 + if (!waitforstop([this]() { return m_iotable[0].getState(); })) break; + } else { + // 快速移动到零点 + moveTo(0 + m_cfg.motor_dzero, m_cfg.motor_default_velocity); + // 等待移动到目标点 + if (!waitforstop([this]() { return !m_iotable[0].getState(); })) break; + } // 移动到零点 if (!exec_move_to_io_task(0, -1)) break; moveToZero = true; diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 1db2dc5..af00fc5 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,5 @@ #pragma once -#define PC_VERSION 513 +#define PC_VERSION 520 #define PC_MANUFACTURER "http://www.iflytop.com/" #define PC_PROJECT_NAME "a8000_subboard" #define PC_IFLYTOP_ENABLE_OS 1