industry/foc/openloop: don't use direction argument, instead use signed velocity

otherwise, when dir=-1 and the velocity value is negative, the output from
velocity is in the opposite direction than the intended one
This commit is contained in:
raiden00pl 2023-10-06 13:10:39 +02:00 committed by Alan Carvalho de Assis
parent a36318c536
commit baa23afbd3
2 changed files with 8 additions and 4 deletions

View File

@ -258,9 +258,11 @@ static int foc_angle_ol_run_b16(FAR foc_angle_b16_t *h,
DEBUGASSERT(h->data);
ol = h->data;
/* Update open-loop */
/* Update open-loop.
* NOTE: we don't use dir argument here, instead we use signed velocity.
*/
motor_openloop_b16(&ol->data, in->vel, in->dir);
motor_openloop_b16(&ol->data, in->vel, 1);
tmp = motor_openloop_angle_get_b16(&ol->data);

View File

@ -259,9 +259,11 @@ static int foc_angle_ol_run_f32(FAR foc_angle_f32_t *h,
DEBUGASSERT(h->data);
ol = h->data;
/* Update open-loop */
/* Update open-loop.
* NOTE: we don't use dir argument here, instead we use signed velocity.
*/
motor_openloop(&ol->data, in->vel, in->dir);
motor_openloop(&ol->data, in->vel, 1.0f);
/* Get open-loop angle */