From 4257580790dc2dda82d0b03a1323746f321331b3 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 23 Oct 2023 13:10:22 +0800 Subject: [PATCH] update --- .../step_motor_ctrl_module.cpp | 22 ++++++++++++++++++---- ...o_computer_module_device_script_cmder_paser.cpp | 10 ++++++++++ ...o_computer_module_device_script_cmder_paser.hpp | 3 ++- components/zprotocols/zcancmder_v2 | 2 +- 4 files changed, 31 insertions(+), 6 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 08457f1..5688ce1 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -729,6 +729,9 @@ int32_t StepMotorCtrlModule::motor_rotate(int32_t direction, int32_t motor_veloc ZLOGI(TAG, "m%d motor_rotate %d", m_id, direction); m_status_cb = nullptr; m_thread.stop(); + if (acc == 0) { + acc = m_param.acc; + } _rotate(direction * motor_velocity, acc, acc); return 0; } @@ -751,6 +754,11 @@ int32_t StepMotorCtrlModule::motor_move_to(int32_t tox, int32_t motor_velocity, if (m_param.max_x != 0 && tox > m_param.max_x) { tox = m_param.max_x; } + + if (acc == 0) { + acc = m_param.acc; + } + m_thread.start( [this, tox, motor_velocity, acc]() { _motor_move_to(tox, motor_velocity, acc, acc); @@ -772,10 +780,16 @@ int32_t StepMotorCtrlModule::motor_move_to_acctime(int32_t position, int32_t mot int32_t StepMotorCtrlModule::motor_move_to_zero_forward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } int32_t StepMotorCtrlModule::motor_move_to_zero_backward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { ZLOGI(TAG, "motor_move_to_zero_backward"); - m_param.run_to_zero_speed = findzerospeed; - m_param.look_zero_edge_speed = findzeroedge_speed; - m_param.look_zero_edge_dec = acc; - m_param.run_to_zero_dec = acc; + if (findzerospeed != 0) { + m_param.run_to_zero_speed = findzerospeed; + } + if (findzeroedge_speed != 0) { + m_param.look_zero_edge_speed = findzeroedge_speed; + } + if (acc != 0) { + m_param.look_zero_edge_dec = acc; + m_param.run_to_zero_dec = acc; + } return move_to_zero(nullptr); } diff --git a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp index 3f50b7e..3fe9cb1 100644 --- a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp +++ b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp @@ -1,6 +1,8 @@ #include "micro_computer_module_device_script_cmder_paser.hpp" +#include #include +#include #include "sdk/os/zos.hpp" using namespace iflytop; @@ -8,6 +10,14 @@ using namespace std; #define TAG "CMD" +void MicroComputerModuleDeviceScriptCmderPaser::do_dumpconfig(int32_t moduleId) { + ICmdParserACK ack; + const char paraV[1][10] = {{0}}; + sprintf((char*)paraV[0], "%d", moduleId); + + do_dumpconfig(1, (const char**)paraV, &ack); +} + void MicroComputerModuleDeviceScriptCmderPaser::do_dumpconfig(int32_t paramN, const char* paraV[], ICmdParserACK* ack) { // ack->ecode = 0; diff --git a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp index 0217897..8fff564 100644 --- a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp +++ b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp @@ -10,7 +10,8 @@ class MicroComputerModuleDeviceScriptCmderPaser : public ZModuleDeviceScriptCmde public: void initialize(ICmdParser* cancmder, ZModuleDeviceManager* deviceManager); - void do_dumpconfig(int32_t paramN, const char* paraV[], ICmdParserACK* ack) ; + void do_dumpconfig(int32_t paramN, const char* paraV[], ICmdParserACK* ack); + void do_dumpconfig(int32_t moduleId); }; } // namespace iflytop diff --git a/components/zprotocols/zcancmder_v2 b/components/zprotocols/zcancmder_v2 index 5ca88d7..0da1095 160000 --- a/components/zprotocols/zcancmder_v2 +++ b/components/zprotocols/zcancmder_v2 @@ -1 +1 @@ -Subproject commit 5ca88d73b1481eb8cba888f7d713129dfcbaf235 +Subproject commit 0da1095ad399f7acbe11f2f5ba166b84268c1df6