This is an automated email from the ASF dual-hosted git repository.

acassis 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 baa23afbd industry/foc/openloop: don't use direction argument, instead 
use signed velocity
baa23afbd is described below

commit baa23afbd39949f73d5b7c67686ff3cc9ca8f4dc
Author: raiden00pl <raide...@railab.me>
AuthorDate: Fri Oct 6 13:10:39 2023 +0200

    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
---
 industry/foc/fixed16/foc_ang_openloop.c | 6 ++++--
 industry/foc/float/foc_ang_openloop.c   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/industry/foc/fixed16/foc_ang_openloop.c 
b/industry/foc/fixed16/foc_ang_openloop.c
index 64f8194b8..8744f2da5 100644
--- a/industry/foc/fixed16/foc_ang_openloop.c
+++ b/industry/foc/fixed16/foc_ang_openloop.c
@@ -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);
 
diff --git a/industry/foc/float/foc_ang_openloop.c 
b/industry/foc/float/foc_ang_openloop.c
index 44122025a..d33f30169 100644
--- a/industry/foc/float/foc_ang_openloop.c
+++ b/industry/foc/float/foc_ang_openloop.c
@@ -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 */
 

Reply via email to