examples/foc: configure active breake current

This commit is contained in:
raiden00pl 2023-10-12 19:55:11 +02:00 committed by Xiang Xiao
parent 6cf6a73fc0
commit 9ee4daea43
3 changed files with 14 additions and 0 deletions

View File

@ -321,6 +321,13 @@ config EXAMPLES_FOC_MMODE
4 - align only
5 - ident only
config EXAMPLES_FOC_STOP_CURRENT
int "FOC stop state Q voltage/current [x1000]"
default 0
---help---
This current or voltage will be forced on the motor Q axis when
the application is in active break state.
config EXAMPLES_FOC_OPENLOOP_Q
int "FOC open-loop Vq/Iq setting [x1000]"
default 200

View File

@ -607,6 +607,10 @@ static int foc_motor_state(FAR struct foc_motor_b16_s *motor, int state)
/* DQ vector not zero - active brake */
motor->dq_ref.q = ftob16(CONFIG_EXAMPLES_FOC_STOP_CURRENT /
1000.0f);
motor->dq_ref.d = 0;
break;
}

View File

@ -585,6 +585,9 @@ static int foc_motor_state(FAR struct foc_motor_f32_s *motor, int state)
/* DQ vector not zero - active brake */
motor->dq_ref.q = CONFIG_EXAMPLES_FOC_STOP_CURRENT / 1000.0f;
motor->dq_ref.d = 0.0f;
break;
}