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 ce2ee9bb3 industry/foc: use b16sign() instead of custom ABS() macro
ce2ee9bb3 is described below
commit ce2ee9bb3f58390dd21a3290dd86ad5c22704fb2
Author: raiden00pl <[email protected]>
AuthorDate: Thu Oct 19 09:20:26 2023 +0200
industry/foc: use b16sign() instead of custom ABS() macro
fixedmath now supports sign functions so we no longer need to use a
dedicated macro
---
industry/foc/fixed16/foc_ang_onfo.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/industry/foc/fixed16/foc_ang_onfo.c
b/industry/foc/fixed16/foc_ang_onfo.c
index f5c2c453f..af1d7565f 100644
--- a/industry/foc/fixed16/foc_ang_onfo.c
+++ b/industry/foc/fixed16/foc_ang_onfo.c
@@ -35,8 +35,6 @@
* Pre-processor Definitions
****************************************************************************/
-#define SIGN(x) ((x > 0) ? b16ONE : -b16ONE)
-
#define LINEAR_MAP(x, in_min, in_max, out_min, out_max) \
(b16divb16(b16mulb16((x - in_min), (out_max - out_min)), \
(in_max - in_min)) + out_min)
@@ -299,7 +297,7 @@ static int foc_angle_onfo_run_b16(FAR foc_angle_b16_t *h,
/* Update duty cycle now */
- duty_now = b16mulb16(SIGN(in->state->vdq.q),
+ duty_now = b16mulb16(b16sign(in->state->vdq.q),
vector2d_mag_b16(v_dq_mod.d, v_dq_mod.q));
/* Update and the observer gain. */