Browse Source

update

master
zhaohe 2 years ago
parent
commit
4257580790
  1. 22
      components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  2. 10
      components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp
  3. 3
      components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp
  4. 2
      components/zprotocols/zcancmder_v2

22
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);
}

10
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#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;

3
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

2
components/zprotocols/zcancmder_v2

@ -1 +1 @@
Subproject commit 5ca88d73b1481eb8cba888f7d713129dfcbaf235
Subproject commit 0da1095ad399f7acbe11f2f5ba166b84268c1df6
Loading…
Cancel
Save