From 6dbc5fa5c7389d75f8766fd8fd11faa72a407c24 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 15 Oct 2023 13:53:32 +0800 Subject: [PATCH] update --- components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp b/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp index b2eb6ea..a052a92 100644 --- a/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp +++ b/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp @@ -107,11 +107,15 @@ int32_t XYRobotCtrlModule::move_by_no_limit(int32_t dx, int32_t dy, int speed, a int32_t XYRobotCtrlModule::move_by(int32_t dx, int32_t dy, int speed, action_cb_status_t status_cb) { zlock_guard lock(m_lock); - ZLOGI(TAG, "move_by dx:%d dy:%d", dx, dy); + ZLOGI(TAG, "move_by dx:%d dy:%d %d", dx, dy, speed); m_thread.stop(); _motor_stop(); + if (speed == 0) { + speed = m_cfg.maxspeed; + } + if (m_cfg.maxspeed != 0 && speed > m_cfg.maxspeed) { speed = m_cfg.maxspeed; }