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