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

xiaoxiang 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 5d4b72059 foc/foc_feedforward.c: vdq_comp->q should use idq->d
5d4b72059 is described below

commit 5d4b7205967012e7b495aa613ff70df37dc6e978
Author: raiden00pl <raide...@railab.me>
AuthorDate: Thu Apr 3 09:48:53 2025 +0200

    foc/foc_feedforward.c: vdq_comp->q should use idq->d
    
    fix typo in calculations for vdq_comp->q. It should use idq->d not idq->q.
    
    Reported in https://github.com/apache/nuttx-apps/issues/3047
    
    Signed-off-by: raiden00pl <raide...@railab.me>
---
 industry/foc/fixed16/foc_feedforward.c | 2 +-
 industry/foc/float/foc_feedforward.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/industry/foc/fixed16/foc_feedforward.c 
b/industry/foc/fixed16/foc_feedforward.c
index 0a3e2fe74..97c1b6699 100644
--- a/industry/foc/fixed16/foc_feedforward.c
+++ b/industry/foc/fixed16/foc_feedforward.c
@@ -63,7 +63,7 @@ int foc_feedforward_pmsm_b16(FAR struct 
motor_phy_params_b16_s *phy,
 
   vdq_comp->q = -b16mulb16(vel_now,
                            (phy->flux_link + b16mulb16(phy->ind,
-                                                       idq->q)));
+                                                       idq->d)));
   vdq_comp->d = b16mulb16(b16mulb16(vel_now, phy->ind), idq->q);
 
   return OK;
diff --git a/industry/foc/float/foc_feedforward.c 
b/industry/foc/float/foc_feedforward.c
index 922696fdd..f9d3c3324 100644
--- a/industry/foc/float/foc_feedforward.c
+++ b/industry/foc/float/foc_feedforward.c
@@ -61,7 +61,7 @@ int foc_feedforward_pmsm_f32(FAR struct 
motor_phy_params_f32_s *phy,
    * so vq compensation must be negative here.
    */
 
-  vdq_comp->q = -vel_now * (phy->flux_link + phy->ind * idq->q);
+  vdq_comp->q = -vel_now * (phy->flux_link + phy->ind * idq->d);
   vdq_comp->d = vel_now * phy->ind * idq->q;
 
   return OK;

Reply via email to