From 29877a4b6436700d0ea9fa418824b4b9aeceb3cd Mon Sep 17 00:00:00 2001 From: NeoZeng Date: Sun, 20 Nov 2022 16:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E6=9C=BA=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E8=A7=92=E5=BA=A6=E8=AE=A1=E7=AE=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/motor/dji_motor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/motor/dji_motor.c b/modules/motor/dji_motor.c index 2077470..2978e77 100644 --- a/modules/motor/dji_motor.c +++ b/modules/motor/dji_motor.c @@ -1,7 +1,7 @@ #include "dji_motor.h" #define PI2 3.141592f -#define ECD_ANGLE_COEF 3.835e-4 // ecd/8192*pi +#define ECD_ANGLE_COEF 0.043945f // 360/8192 static uint8_t idx = 0; // register idx,是该文件的全局电机索引,在注册时使用 @@ -139,7 +139,7 @@ static void DecodeDJIMotor(can_instance *_instance) measure->total_round--; else if (measure->ecd - measure->last_ecd < -4096) measure->total_round++; - measure->total_angle = measure->total_round * PI2 + measure->ecd * ECD_ANGLE_COEF; // @todo simplify the calculation + measure->total_angle = measure->total_round * 360 + measure->ecd * ECD_ANGLE_COEF; // @todo simplify the calculation break; } }