This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a36318c53 industry/foc/fixed16/foc_ang_onfo.c: use b16abs operation
a36318c53 is described below

commit a36318c53647d2d6b138e2cefadde7ba3ce683d2
Author: raiden00pl <raide...@railab.me>
AuthorDate: Tue Oct 10 20:31:59 2023 +0200

    industry/foc/fixed16/foc_ang_onfo.c: use b16abs operation
    
    we get rid of custom ABS() macro
---
 industry/foc/fixed16/foc_ang_onfo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/industry/foc/fixed16/foc_ang_onfo.c 
b/industry/foc/fixed16/foc_ang_onfo.c
index 76b54a6a3..d778a2586 100644
--- a/industry/foc/fixed16/foc_ang_onfo.c
+++ b/industry/foc/fixed16/foc_ang_onfo.c
@@ -41,10 +41,6 @@
   (b16divb16(b16mulb16((x - in_min), (out_max - out_min)),  \
              (in_max - in_min)) + out_min)
 
-#ifndef ABS
-#  define ABS(a)   (a < 0 ? -a : a)
-#endif
-
 /****************************************************************************
  * Private Data Types
  ****************************************************************************/
@@ -299,7 +295,7 @@ static int foc_angle_onfo_run_b16(FAR foc_angle_b16_t *h,
 
   /* Update and the observer gain. */
 
-  dyn_gain = b16mulb16(LINEAR_MAP(ABS(duty_now),
+  dyn_gain = b16mulb16(LINEAR_MAP(b16abs(duty_now),
                                   0,
                                   b16ONE,
                                   b16mulb16(ob->cfg.gain, ob->cfg.gain_slow),

Reply via email to