From ce82cd5cc93d90fd4c9eede02bf2b12ae9c1c3dd Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 3 Jun 2024 13:05:57 +0800 Subject: [PATCH] update --- components/step_motor_ctrl_module/step_motor_ctrl_module.cpp | 8 ++++---- components/step_motor_ctrl_module/step_motor_ctrl_module.hpp | 3 +++ components/zcancmder/zcan_protocol_parser.cpp | 9 +++++++++ components/zcancmder/zcan_protocol_parser.hpp | 4 ++++ 4 files changed, 20 insertions(+), 4 deletions(-) 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 31ee245..bdf25a0 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -285,20 +285,20 @@ int32_t StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t direc vTaskDelay(1); } - // 等待电机停止 + // 绛夊緟鐢垫満鍋滄 while (!m_stepM1->isStoped() && !m_thread.getExitFlag()) { m_stepM1->stop(); vTaskDelay(100); } - // 失败返回 + // 澶辫触杩斿洖 if (!xreach_io) { ZLOGE(TAG, "x reach io failed"); return err::kxymotor_not_found_x_zero_point; } } - // 如果设备已经在零点,则反向移动一定距离远离零点 + // 濡傛灉璁惧宸茬粡鍦ㄩ浂鐐癸紝鍒欏弽鍚戠Щ鍔ㄤ竴瀹氳窛绂昏繙绂婚浂鐐 if (gpio->getState()) { ZLOGI(TAG, "---------STEP2-------- find edge"); _rotate(-direction * lookPointVelocity, lookPointDec, lookPointDec); @@ -313,7 +313,7 @@ int32_t StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t direc vTaskDelay(1); } - while (!m_stepM1->isStoped() && !m_thread.getExitFlag()) { // 等待电机停止 + while (!m_stepM1->isStoped() && !m_thread.getExitFlag()) { // 绛夊緟鐢垫満鍋滄 m_stepM1->stop(); vTaskDelay(100); } diff --git a/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp b/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp index ddfe6b5..adf27a6 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp @@ -59,7 +59,10 @@ class StepMotorCtrlModule : public ZIModule, public ZIStepMotor { *id = m_id; return 0; } + virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& val); + virtual int32_t module_stop() override { return step_motor_stop(0); } + virtual int32_t module_active_cfg() override { return step_motor_active_cfg(); } /*********************************************************************************************************************** * ZIStepMotor * ***********************************************************************************************************************/ diff --git a/components/zcancmder/zcan_protocol_parser.cpp b/components/zcancmder/zcan_protocol_parser.cpp index f1e972c..ef5f255 100644 --- a/components/zcancmder/zcan_protocol_parser.cpp +++ b/components/zcancmder/zcan_protocol_parser.cpp @@ -156,6 +156,15 @@ int32_t ZCanProtocolParser::module_clear_error(cmdcontxt_t* cxt) { return module->module_clear_error(); } +int32_t ZCanProtocolParser::module_stop(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(0); + return module->module_stop(); +} +int32_t ZCanProtocolParser::module_active_cfg(cmdcontxt_t* cxt) { + CHECK_AND_GET_MODULE(0); + return module->module_active_cfg(); +} + #undef MODULE_CLASS /*********************************************************************************************************************** diff --git a/components/zcancmder/zcan_protocol_parser.hpp b/components/zcancmder/zcan_protocol_parser.hpp index 055a61b..df6ebf9 100644 --- a/components/zcancmder/zcan_protocol_parser.hpp +++ b/components/zcancmder/zcan_protocol_parser.hpp @@ -52,6 +52,10 @@ class ZCanProtocolParser : public IZCanReceiverListener { static int32_t module_get_reg(cmdcontxt_t* cxt); static int32_t module_get_error(cmdcontxt_t* cxt); static int32_t module_clear_error(cmdcontxt_t* cxt); + static int32_t module_stop(cmdcontxt_t* cxt); + static int32_t module_active_cfg(cmdcontxt_t* cxt); + + static int32_t step_motor_enable(cmdcontxt_t* cxt); static int32_t step_motor_stop(cmdcontxt_t* cxt);