From 5a65f3d48febd67d9f08993e1fe14273a065bd7e Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 16 Oct 2023 14:15:44 +0200 Subject: [PATCH] industry/foc: reset align data when align is finished this allows the align procedure to be run multiple times --- industry/foc/fixed16/foc_align.c | 7 +++++++ industry/foc/float/foc_align.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/industry/foc/fixed16/foc_align.c b/industry/foc/fixed16/foc_align.c index 063ab75ec..e60be98ef 100644 --- a/industry/foc/fixed16/foc_align.c +++ b/industry/foc/fixed16/foc_align.c @@ -1005,5 +1005,12 @@ int foc_routine_align_final_b16(FAR foc_routine_b16_t *r, FAR void *data) memcpy(data, &a->final, sizeof(struct foc_routine_aling_final_b16_s)); + /* Reset data but leave configuration */ + + memset(&a->final, + 0, + (sizeof(struct foc_align_b16_s) - + sizeof(struct foc_routine_align_cfg_b16_s))); + return OK; } diff --git a/industry/foc/float/foc_align.c b/industry/foc/float/foc_align.c index d398e6352..16c212934 100644 --- a/industry/foc/float/foc_align.c +++ b/industry/foc/float/foc_align.c @@ -1005,5 +1005,12 @@ int foc_routine_align_final_f32(FAR foc_routine_f32_t *r, FAR void *data) memcpy(data, &a->final, sizeof(struct foc_routine_aling_final_f32_s)); + /* Reset data but leave configuration */ + + memset(&a->final, + 0, + (sizeof(struct foc_align_f32_s) - + sizeof(struct foc_routine_align_cfg_f32_s))); + return OK; }