From 93d49d627278876a25d6142c45b5c98e42ffc173 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 14 Jan 2024 13:05:58 +0800 Subject: [PATCH] update --- components/step_motor_ctrl_module/step_motor_ctrl_module.cpp | 7 +++++-- components/step_motor_ctrl_module/step_motor_ctrl_module.hpp | 2 +- .../micro_computer_module_device_script_cmder_paser.cpp | 4 ++++ components/zprotocols/zcancmder_v2 | 2 +- 4 files changed, 11 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 cb5d171..684d3a6 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp @@ -394,8 +394,9 @@ void StepMotorCtrlModule::create_default_cfg(flash_config_t& cfg) { cfg.base_param.motor_one_circle_pulse = 10000; cfg.base_param.motor_one_circle_pulse_denominator = 1; cfg.base_param.stepmotor_ihold = 1; - cfg.base_param.stepmotor_irun = 3; + cfg.base_param.stepmotor_irun = 31; cfg.base_param.stepmotor_iholddelay = 100; + cfg.base_param.stepmotor_iglobalscaler = 1; cfg.base_param.motor_default_acc = 300; cfg.base_param.motor_default_dec = 300; cfg.base_param.motor_default_velocity = 500; @@ -430,6 +431,7 @@ int32_t StepMotorCtrlModule::factory_reset() { } void StepMotorCtrlModule::active_cfg() { m_stepM1->setIHOLD_IRUN(m_param.stepmotor_ihold, m_param.stepmotor_irun, m_param.stepmotor_iholddelay); + // stepmotor_iglobalscaler m_stepM1->setScale(m_param.motor_one_circle_pulse); m_stepM1->setScaleDenominator(m_param.motor_one_circle_pulse_denominator); m_stepM1->setMotorShaft(m_param.motor_shaft); @@ -475,6 +477,7 @@ int32_t StepMotorCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t PROCESS_REG(kreg_stepmotor_ihold, REG_GET(m_param.stepmotor_ihold), REG_SET(m_param.stepmotor_ihold)); PROCESS_REG(kreg_stepmotor_irun, REG_GET(m_param.stepmotor_irun), REG_SET(m_param.stepmotor_irun)); PROCESS_REG(kreg_stepmotor_iholddelay, REG_GET(m_param.stepmotor_iholddelay), REG_SET(m_param.stepmotor_iholddelay)); + PROCESS_REG(kreg_stepmotor_iglobalscaler, REG_GET(m_param.stepmotor_iglobalscaler), REG_SET(m_param.stepmotor_iglobalscaler)); PROCESS_REG(kreg_motor_max_d, REG_GET(m_param.max_d), REG_SET(m_param.max_d)); PROCESS_REG(kreg_motor_min_d, REG_GET(m_param.min_d), REG_SET(m_param.min_d)); PROCESS_REG(kreg_module_input_state, module_readio(&val), ACTION_NONE); @@ -733,7 +736,7 @@ int32_t StepMotorCtrlModule::_exec_move_to_io_task_fn(int32_t ioindex, int32_t d int32_t StepMotorCtrlModule::_exec_move_to_zero_task(int32_t& dx) { int32_t pos1 = 0; int32_t pos2 = 0; - int32_t ret = 0; + int32_t ret = 0; getnowpos(pos1); ret = _exec_move_to_zero_task(); getnowpos(pos2); 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 c16023b..3bed942 100644 --- a/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp +++ b/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp @@ -15,7 +15,7 @@ class StepMotorCtrlModule : public ZIModule, public ZIMotor { int32_t stepmotor_ihold; int32_t stepmotor_irun; int32_t stepmotor_iholddelay; - + int32_t stepmotor_iglobalscaler; int32_t motor_default_acc; int32_t motor_default_dec; int32_t motor_default_velocity; 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 da7c93c..8b3a0be 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 @@ -35,6 +35,9 @@ void MicroComputerModuleDeviceScriptCmderPaser::initialize(ICmdParser* cancmder, do_scan_module(paramN, paraV, ack); }); + cancmder->regCMD("reboot", "()", 0, [this](int32_t paramN, const char* paraV[], ICmdParserACK* ack) { // + NVIC_SystemReset(); + }); /******************************************************************************* * ½Ó¿Ú * *******************************************************************************/ @@ -233,6 +236,7 @@ void MicroComputerModuleDeviceScriptCmderPaser::app_dump_reg(int32_t moduleId, i DUMP_CONFIG("stepmotor_ihold", kreg_stepmotor_ihold); DUMP_CONFIG("stepmotor_irun", kreg_stepmotor_irun); DUMP_CONFIG("stepmotor_iholddelay", kreg_stepmotor_iholddelay); + DUMP_CONFIG("stepmotor_iglobalscaler", kreg_stepmotor_iglobalscaler); DUMP_CONFIG("motor_run_to_zero_max_d", kreg_motor_run_to_zero_max_d); DUMP_CONFIG("motor_look_zero_edge_max_d", kreg_motor_look_zero_edge_max_d); DUMP_CONFIG("motor_run_to_zero_speed", kreg_motor_run_to_zero_speed); diff --git a/components/zprotocols/zcancmder_v2 b/components/zprotocols/zcancmder_v2 index e9e173b..d06f09d 160000 --- a/components/zprotocols/zcancmder_v2 +++ b/components/zprotocols/zcancmder_v2 @@ -1 +1 @@ -Subproject commit e9e173b2cc1d43a6946ab7de8f21169e680e3b8f +Subproject commit d06f09d8b3724156381c36d0cc5d0d9a0b098cc4