Browse Source

fix some bug

master
zhaohe 1 year ago
parent
commit
30cab5983b
  1. 6
      sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp
  2. 5
      sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  3. 2
      usrc/project_configs.h

6
sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp

@ -65,7 +65,7 @@ int32_t MiniServoCtrlModule::mini_servo_rotate(int32_t speed) {
if (!m_bus->ping(m_idinbus)) return err::ksubdevice_overtime;
if (!m_state.enable) return err::kmini_servo_not_enable;
if (!m_bus->isSupportMode1(m_idinbus)) return err::kmini_servo_mode_not_support;
creg.module_status = 1;
m_thread.start(
[this, speed]() {
befor_motor_move();
@ -100,7 +100,7 @@ int32_t MiniServoCtrlModule::mini_servo_move_to(int32_t pos3600) {
if (!m_bus->ping(m_idinbus)) return err::ksubdevice_overtime;
if (!m_state.enable) return err::kmini_servo_not_enable;
if (!m_bus->isSupportMode0(m_idinbus)) return err::kmini_servo_mode_not_support;
creg.module_status = 1;
m_thread.start(
[this, pos3600]() {
befor_motor_move();
@ -153,7 +153,7 @@ int32_t MiniServoCtrlModule::mini_servo_rotate_with_torque(int32_t torque) {
if (!m_bus->ping(m_idinbus)) return err::ksubdevice_overtime;
if (!m_state.enable) return err::kmini_servo_not_enable;
if (!m_bus->isSupportMode2(m_idinbus)) return err::kmini_servo_mode_not_support;
creg.module_status = 1;
m_thread.start(
[this, torque]() {
befor_motor_move();

5
sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -495,6 +495,7 @@ int32_t StepMotorCtrlModule::step_motor_easy_reciprocating_motion(int32_t startp
if (m_cfg.min_d != 0 && x_endpos < m_cfg.min_d) x_endpos = m_cfg.min_d;
if (m_cfg.max_d != 0 && x_endpos > m_cfg.max_d) x_endpos = m_cfg.max_d;
m_thread.stop();
creg.module_status = 1;
m_thread.start(
[this, x_startpos, x_endpos, x_beginpos, times]() {
befor_motor_move();
@ -537,6 +538,7 @@ int32_t StepMotorCtrlModule::step_motor_easy_reciprocating_motion(int32_t startp
int32_t StepMotorCtrlModule::do_step_motor_easy_rotate(int32_t direction) {
m_thread.stop();
creg.module_status = 1;
m_thread.start(
[this, direction]() {
befor_motor_move();
@ -559,6 +561,7 @@ int32_t StepMotorCtrlModule::do_step_motor_easy_move_to(int32_t tox) {
if (m_cfg.min_d != 0 && tox < m_cfg.min_d) tox = m_cfg.min_d;
if (m_cfg.max_d != 0 && tox > m_cfg.max_d) tox = m_cfg.max_d;
m_thread.stop();
creg.module_status = 1;
m_thread.start(
[this, tox]() {
befor_motor_move();
@ -589,6 +592,7 @@ int32_t StepMotorCtrlModule::do_step_motor_easy_move_by(int32_t distance) {
int32_t StepMotorCtrlModule::do_step_motor_easy_move_to_zero() {
m_thread.stop();
creg.module_status = 1;
m_thread.start(
[this]() {
befor_motor_move();
@ -609,6 +613,7 @@ int32_t StepMotorCtrlModule::do_step_motor_easy_move_to_io(int32_t ioindex, int3
}
m_thread.stop();
creg.module_status = 1;
m_thread.start(
[this, ioindex, direction]() {
befor_motor_move();

2
usrc/project_configs.h

@ -1,5 +1,5 @@
#pragma once
#define PC_VERSION 511
#define PC_VERSION 512
#define PC_MANUFACTURER "http://www.iflytop.com/"
#define PC_PROJECT_NAME "a8000_subboard"
#define PC_IFLYTOP_ENABLE_OS 1

Loading…
Cancel
Save