From 96feb958a5bed002cba414d5276620456300f3a9 Mon Sep 17 00:00:00 2001 From: Robofish <1683502971@qq.com> Date: Fri, 3 Oct 2025 22:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AErm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/User_code/device/motor_rm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/User_code/device/motor_rm.c b/assets/User_code/device/motor_rm.c index ba10434..9b5ea44 100644 --- a/assets/User_code/device/motor_rm.c +++ b/assets/User_code/device/motor_rm.c @@ -139,13 +139,13 @@ static void Motor_RM_Decode(MOTOR_RM_t *motor, BSP_CAN_Message_t *msg) { motor->feedback.rotor_speed = rotor_speed; motor->feedback.torque_current = torque_current; } - if (motor->motor.reverse) { while (motor->feedback.rotor_abs_angle < 0) { motor->feedback.rotor_abs_angle += M_2PI; } while (motor->feedback.rotor_abs_angle >= M_2PI) { motor->feedback.rotor_abs_angle -= M_2PI; } + if (motor->motor.reverse) { motor->feedback.rotor_abs_angle = M_2PI - motor->feedback.rotor_abs_angle; motor->feedback.rotor_speed = -motor->feedback.rotor_speed; motor->feedback.torque_current = -motor->feedback.torque_current;