You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/02/19 23:36:42 UTC

[incubator-nuttx-apps] 01/05: industry/foc: rename dir to sensor_dir to be clear that it relates to the direction of the sensor, no movement direction

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/incubator-nuttx-apps.git

commit d6cdc5a4237d11eb768e61504733efd8927cd750
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sat Feb 19 17:36:40 2022 +0100

    industry/foc: rename dir to sensor_dir to be clear that it relates to the direction of the sensor, no movement direction
---
 industry/foc/float/foc_ang_onfo.c  | 6 +++---
 industry/foc/float/foc_ang_osmo.c  | 6 +++---
 industry/foc/float/foc_ang_qenco.c | 8 ++++----
 industry/foc/float/foc_vel_odiv.c  | 8 ++++----
 industry/foc/float/foc_vel_opll.c  | 8 ++++----
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/industry/foc/float/foc_ang_onfo.c b/industry/foc/float/foc_ang_onfo.c
index eef0868..9ec8c3b 100644
--- a/industry/foc/float/foc_ang_onfo.c
+++ b/industry/foc/float/foc_ang_onfo.c
@@ -50,7 +50,7 @@ struct foc_observer_f32_s
 {
   struct foc_observer_cfg_f32_s cfg;
   struct motor_aobserver_f32_s  data;
-  float                         dir;
+  float                         sensor_dir;
 };
 
 /****************************************************************************
@@ -198,7 +198,7 @@ static int foc_angle_onfo_cfg_f32(FAR foc_angle_f32_t *h, FAR void *cfg)
 
   /* Initialize with CW direction */
 
-  ob->dir = DIR_CW;
+  ob->sensor_dir = DIR_CW;
 
   return OK;
 errout:
@@ -264,7 +264,7 @@ static int foc_angle_onfo_dir_f32(FAR foc_angle_f32_t *h, float dir)
 
   /* Configure direction */
 
-  ob->dir = dir;
+  ob->sensor_dir = dir;
 
   return OK;
 }
diff --git a/industry/foc/float/foc_ang_osmo.c b/industry/foc/float/foc_ang_osmo.c
index bf0e385..c93c026 100644
--- a/industry/foc/float/foc_ang_osmo.c
+++ b/industry/foc/float/foc_ang_osmo.c
@@ -41,7 +41,7 @@ struct foc_observer_f32_s
 {
   struct foc_observer_cfg_f32_s cfg;
   struct motor_aobserver_f32_s  data;
-  float                         dir;
+  float                         sensor_dir;
 };
 
 /****************************************************************************
@@ -188,7 +188,7 @@ static int foc_angle_osmo_cfg_f32(FAR foc_angle_f32_t *h, FAR void *cfg)
 
   /* Initialize with CW direction */
 
-  ob->dir = DIR_CW;
+  ob->sensor_dir = DIR_CW;
 
   return OK;
 errout:
@@ -254,7 +254,7 @@ static int foc_angle_osmo_dir_f32(FAR foc_angle_f32_t *h, float dir)
 
   /* Configure direction */
 
-  ob->dir = dir;
+  ob->sensor_dir = dir;
 
   return OK;
 }
diff --git a/industry/foc/float/foc_ang_qenco.c b/industry/foc/float/foc_ang_qenco.c
index cfde176..aaa36f5 100644
--- a/industry/foc/float/foc_ang_qenco.c
+++ b/industry/foc/float/foc_ang_qenco.c
@@ -48,7 +48,7 @@ struct foc_qenco_f32_s
   int32_t                    pos;
   int32_t                    offset;
   float                      one_by_posmax;
-  float                      dir;
+  float                      sensor_dir;
   float                      angle;
   struct foc_qenco_cfg_f32_s cfg;
 };
@@ -226,7 +226,7 @@ static int foc_angle_qe_cfg_f32(FAR foc_angle_f32_t *h, FAR void *cfg)
 
   /* Initialize with CW direction */
 
-  qe->dir = DIR_CW;
+  qe->sensor_dir = DIR_CW;
 
   /* Reset offset */
 
@@ -303,7 +303,7 @@ static int foc_angle_qe_dir_f32(FAR foc_angle_f32_t *h, float dir)
 
   /* Configure direction */
 
-  qe->dir = dir;
+  qe->sensor_dir = dir;
 
   return OK;
 }
@@ -346,7 +346,7 @@ static int foc_angle_qe_run_f32(FAR foc_angle_f32_t *h,
 
   /* Get mechanical angle */
 
-  qe->angle = (qe->dir * (qe->pos - qe->offset) *
+  qe->angle = (qe->sensor_dir * (qe->pos - qe->offset) *
                qe->one_by_posmax * MOTOR_ANGLE_M_MAX);
 
   /* Normalize angle */
diff --git a/industry/foc/float/foc_vel_odiv.c b/industry/foc/float/foc_vel_odiv.c
index 41604f6..cd3e5f5 100644
--- a/industry/foc/float/foc_vel_odiv.c
+++ b/industry/foc/float/foc_vel_odiv.c
@@ -49,7 +49,7 @@ struct foc_div_f32_s
   struct foc_vel_div_f32_cfg_s     cfg;
   struct motor_sobserver_div_f32_s data;
   struct motor_sobserver_f32_s     o;
-  float                            dir;
+  float                            sensor_dir;
 };
 
 /****************************************************************************
@@ -176,7 +176,7 @@ static int foc_velocity_div_cfg_f32(FAR foc_velocity_f32_t *h, FAR void *cfg)
 
   /* Initialize with CW direction */
 
-  div->dir = DIR_CW;
+  div->sensor_dir = DIR_CW;
 
   return ret;
 }
@@ -237,7 +237,7 @@ static int foc_velocity_div_dir_f32(FAR foc_velocity_f32_t *h, float dir)
 
   /* Set direction */
 
-  div->dir = dir;
+  div->sensor_dir = dir;
 
   return OK;
 }
@@ -273,7 +273,7 @@ static int foc_velocity_div_run_f32(FAR foc_velocity_f32_t *h,
 
   /* Copy data */
 
-  out->velocity = div->dir * motor_sobserver_speed_get(&div->o);
+  out->velocity = div->sensor_dir * motor_sobserver_speed_get(&div->o);
 
   return OK;
 }
diff --git a/industry/foc/float/foc_vel_opll.c b/industry/foc/float/foc_vel_opll.c
index 8b20eba..5e7cfc9 100644
--- a/industry/foc/float/foc_vel_opll.c
+++ b/industry/foc/float/foc_vel_opll.c
@@ -49,7 +49,7 @@ struct foc_pll_f32_s
   struct foc_vel_pll_f32_cfg_s     cfg;
   struct motor_sobserver_pll_f32_s data;
   struct motor_sobserver_f32_s     o;
-  float                            dir;
+  float                            sensor_dir;
 };
 
 /****************************************************************************
@@ -175,7 +175,7 @@ static int foc_velocity_pll_cfg_f32(FAR foc_velocity_f32_t *h, FAR void *cfg)
 
   /* Initialize with CW direction */
 
-  pll->dir = DIR_CW;
+  pll->sensor_dir = DIR_CW;
 
   return ret;
 }
@@ -235,7 +235,7 @@ static int foc_velocity_pll_dir_f32(FAR foc_velocity_f32_t *h, float dir)
 
   /* Set direction */
 
-  pll->dir = dir;
+  pll->sensor_dir = dir;
 
   return OK;
 }
@@ -271,7 +271,7 @@ static int foc_velocity_pll_run_f32(FAR foc_velocity_f32_t *h,
 
   /* Copy data */
 
-  out->velocity = pll->dir * motor_sobserver_speed_get(&pll->o);
+  out->velocity = pll->sensor_dir * motor_sobserver_speed_get(&pll->o);
 
   return OK;
 }