pref: 为三个方向设置独立的标志位

保证移动距离完整,防止下发某一方向速度指令时,导致其他方向无法正常退出距离控制模式的问题
This commit is contained in:
bmy
2024-07-28 16:24:31 +08:00
parent 73b2e1a7e9
commit f2caaae8c8
4 changed files with 99 additions and 43 deletions

View File

@@ -25,37 +25,37 @@ void by_messy_loop(void)
switch (cmd) {
case 0x31: // 设置速度 x
memcpy(&motion_speed_struct.v_x, buff, sizeof(motion_speed_struct.v_x));
by_motion_set_mode(0);
by_motion_set_mode_x(0);
break;
case 0x32: // 设置速度 y
memcpy(&motion_speed_struct.v_y, buff, sizeof(motion_speed_struct.v_y));
by_motion_set_mode(0);
by_motion_set_mode_y(0);
break;
case 0x33: // 设置速度 omega
memcpy(&motion_speed_struct.v_w, buff, sizeof(motion_speed_struct.v_w));
by_motion_set_mode(0);
by_motion_set_mode_w(0);
break;
case 0x34: // 设置移动距离 x
by_frame_send(cmd, buff); // 正确接收后直接返回原文
memcpy(&motion_speed_struct.v_x, buff, sizeof(motion_speed_struct.v_x));
by_motion_set_mode(1);
by_motion_set_mode_x(1);
motion_time_struct.t_x += buff[1];
break;
case 0x35: // 设置移动距离 y
by_frame_send(cmd, buff); // 正确接收后直接返回原文
memcpy(&motion_speed_struct.v_y, buff, sizeof(motion_speed_struct.v_y));
by_motion_set_mode(1);
by_motion_set_mode_y(1);
motion_time_struct.t_y += buff[1];
break;
case 0x36: // 设置旋转角度 omega
by_frame_send(cmd, buff); // 正确接收后直接返回原文
memcpy(&motion_speed_struct.v_w, buff, sizeof(motion_speed_struct.v_w));
by_motion_set_mode(1);
by_motion_set_mode_w(1);
motion_time_struct.t_w += buff[1];
break;