examples/foc: add controller IDLE mode
This commit is contained in:
parent
5eebfbb441
commit
cc189ef170
@ -531,6 +531,7 @@ static int foc_motor_setpoint(FAR struct foc_motor_f32_s *motor, uint32_t sp)
|
|||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
||||||
case FOC_MMODE_IDENT_ONLY:
|
case FOC_MMODE_IDENT_ONLY:
|
||||||
#endif
|
#endif
|
||||||
|
case FOC_MMODE_IDLE:
|
||||||
{
|
{
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
|
|
||||||
@ -1005,6 +1006,11 @@ int foc_motor_init(FAR struct foc_motor_f32_s *motor,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
if (motor->envp->cfg->mmode == FOC_MMODE_IDLE)
|
||||||
|
{
|
||||||
|
motor->ctrl_state = FOC_CTRL_STATE_IDLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
motor->ctrl_state = FOC_CTRL_STATE_INIT;
|
motor->ctrl_state = FOC_CTRL_STATE_INIT;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ static void foc_help(void)
|
|||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
||||||
PRINTF(" 5 - ident only\n");
|
PRINTF(" 5 - ident only\n");
|
||||||
#endif
|
#endif
|
||||||
|
PRINTF(" 6 - IDLE state\n");
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
||||||
PRINTF(" [-r] torque [x1000]\n");
|
PRINTF(" [-r] torque [x1000]\n");
|
||||||
@ -343,7 +344,7 @@ int validate_args(FAR struct args_s *args)
|
|||||||
|
|
||||||
/* Example control mode */
|
/* Example control mode */
|
||||||
|
|
||||||
if (
|
if (args->cfg.mmode != FOC_MMODE_IDLE &&
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_TORQ
|
||||||
args->cfg.mmode != FOC_MMODE_TORQ &&
|
args->cfg.mmode != FOC_MMODE_TORQ &&
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,6 +79,7 @@ enum foc_motor_mode_e
|
|||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
||||||
FOC_MMODE_IDENT_ONLY = 5, /* Motor identification only */
|
FOC_MMODE_IDENT_ONLY = 5, /* Motor identification only */
|
||||||
#endif
|
#endif
|
||||||
|
FOC_MMODE_IDLE = 6, /* IDLE state */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Controller state */
|
/* Controller state */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user