From a36318c53647d2d6b138e2cefadde7ba3ce683d2 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Tue, 10 Oct 2023 20:31:59 +0200 Subject: [PATCH] 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),