Explorar el Código

2/3用宏定义表示

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 3 años
padre
commit
476fc5e651
Se han modificado 2 ficheros con 3 adiciones y 1 borrados
  1. 1 1
      Applications/foc/core/PMSM_FOC_Core.c
  2. 2 0
      Applications/math/fast_math.h

+ 1 - 1
Applications/foc/core/PMSM_FOC_Core.c

@@ -349,7 +349,7 @@ static __INLINE float PMSM_FOC_Update_Input(void) {
 
 	Clark(iabc[0], iabc[1], iabc[2], &iAB);
 
-	foc_observer_update(gFoc_Ctrl.out.s_OutVAB.a * 0.66667f, gFoc_Ctrl.out.s_OutVAB.b * 0.66667f, iAB.a, iAB.b);
+	foc_observer_update(gFoc_Ctrl.out.s_OutVAB.a * TWO_BY_THREE, gFoc_Ctrl.out.s_OutVAB.b * TWO_BY_THREE, iAB.a, iAB.b);
 
 	if (!count_down) {
 		return false;

+ 2 - 0
Applications/math/fast_math.h

@@ -8,8 +8,10 @@
 #define SQRT3_BY_2				(0.86602540378f)
 #define SQRT3                   (1.73205080757f)
 #define SQRT2_BY_SQRT3          (0.8164966f)
+#define	TWO_BY_THREE            (0.66667f)
 #define M_PI (3.14159265f)
 
+
 #define ONE_BY_SQRT3_Q14  (9459L) //0.57735026919 * 16384.0F
 #define SQRT3_BY_2_Q14    (14189L)//0.86602540378 * 16384.0F
 #define TWO_BY_SQRT3_Q14  (18918L)