feat: 修正左右电机物理方向差异

This commit is contained in:
2026-04-14 19:32:06 +08:00
parent fb9e67a955
commit a2328edbd7

View File

@@ -71,6 +71,11 @@ void motor_set_speed(motor_id_t motor_id, int16_t speed)
default: return;
}
/* 纠正左右电机物理方向差异 */
if (motor_id == MOTOR_3 || motor_id == MOTOR_4) {
speed = -speed;
}
/* 限制速度范围 (ARR=3599) */
if (speed > 3599) speed = 3599;
if (speed < -3599) speed = -3599;