From c2e51f77060b96c5dc1c88d0db2ecae846115621 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 16 Oct 2023 16:10:52 +0800 Subject: [PATCH] fix step motor ctrl bug --- components/step_motor_ctrl_module/step_motor_ctrl_module.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp index 2c79df1..331174b 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -417,7 +417,10 @@ int32_t StepMotorCtrlModule::exec_move_to_zero_task() { _motor_move_by(m_param.look_zero_edge_max_d, m_param.look_zero_edge_speed, m_param.acc, m_param.look_zero_edge_dec); while (!_motor_is_reach_target()) { if (m_thread.getExitFlag()) break; - if (!m_Xgpio->getState()) break; + if (!m_Xgpio->getState()) { + _motor_stop(-1); + break; + } vTaskDelay(1); } }