Skip to content

Commit

Permalink
industry/foc: use b16sign() instead of custom ABS() macro
Browse files Browse the repository at this point in the history
fixedmath now supports sign functions so we no longer need to use a dedicated macro
  • Loading branch information
raiden00pl authored and xiaoxiang781216 committed Oct 19, 2023
1 parent 1c922f2 commit ce2ee9b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions industry/foc/fixed16/foc_ang_onfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit ce2ee9b

Please sign in to comment.