diff --git a/a8000_protocol b/a8000_protocol index 644059e..a16732b 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 644059e79fd881d2a6c0d2f9b6ddc1098d9fabe4 +Subproject commit a16732b2c0be0cec93c0099b56643befe27fe411 diff --git a/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp b/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp index 5f3da7a..1a9cdc9 100644 --- a/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp +++ b/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp @@ -20,9 +20,10 @@ void MiniServoCtrlModule::initialize(uint16_t module_id, FeiTeServoMotor *bus, u mini_servo_enable(1); } void MiniServoCtrlModule::create_default_config(config_t &cfg) { - cfg.limit_velocity = 10000; - cfg.limit_torque = 300; - cfg.protective_torque = 800; + cfg.limit_velocity = 10000; + cfg.limit_torque = 300; + cfg.protective_torque = 800; + cfg.target_pos_tolerance = 15; } int32_t MiniServoCtrlModule::getid(int32_t *id) { @@ -36,6 +37,7 @@ int32_t MiniServoCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t PROCESS_REG(kreg_mini_servo_limit_velocity, REG_GET(m_cfg.limit_velocity), REG_SET(m_cfg.limit_velocity)); PROCESS_REG(kreg_mini_servo_limit_torque, REG_GET(m_cfg.limit_torque), REG_SET(m_cfg.limit_torque)); PROCESS_REG(kreg_mini_servo_protective_torque, REG_GET(m_cfg.protective_torque), REG_SET(m_cfg.protective_torque)); + PROCESS_REG(kreg_mini_servo_target_pos_tolerance, REG_GET(m_cfg.target_pos_tolerance), REG_SET(m_cfg.target_pos_tolerance)); PROCESS_REG(kreg_mini_servo_is_move, mini_servo_is_move(&val), ACTION_NONE); PROCESS_REG(kreg_mini_servo_status, mini_servo_read_reg(kreg_mini_servo_status, &val), ACTION_NONE); @@ -174,12 +176,11 @@ int32_t MiniServoCtrlModule::mini_servo_move_to(int32_t pos3600) { return; } - while (true) { if (m_thread.getExitFlag()) break; if (!check_when_run(&status)) break; - if (poseq(status.pos, pos3600, 10) && status.isMove == 0) break; + if (poseq(status.pos, pos3600, m_cfg.target_pos_tolerance) && status.isMove == 0) break; vTaskDelay(5); } diff --git a/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp b/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp index 883db16..cccf00e 100644 --- a/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp +++ b/sdk/components/mini_servo_motor/mini_servo_motor_ctrl_module.hpp @@ -13,9 +13,10 @@ class MiniServoCtrlModule : public ZIModule { public: typedef struct { int32_t shaft; - int32_t limit_velocity; // 0->10000 ,位置模式,有效。 - int32_t limit_torque; // 0->1000 ,位置模式,速度模式,有效。 - int32_t protective_torque; // 0->1000 ,暂时为使用 + int32_t limit_velocity; // 0->10000 ,位置模式,有效。 + int32_t limit_torque; // 0->1000 ,位置模式,速度模式,有效。 + int32_t protective_torque; // 0->1000 ,暂时为使用 + int32_t target_pos_tolerance; // 0->3600 } config_t; typedef struct {