examples/foc: add missing deinit calls
This commit is contained in:
parent
f358bdfcb3
commit
caba5a0a6f
@ -1046,6 +1046,39 @@ int foc_motor_deinit(FAR struct foc_motor_b16_s *motor)
|
|||||||
|
|
||||||
DEBUGASSERT(motor);
|
DEBUGASSERT(motor);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_OPENLOOP
|
||||||
|
/* Deinitialzie open-loop handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_b16(&motor->openloop);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_b16 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_QENCO
|
||||||
|
/* Deinitialzie qenco handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_b16(&motor->qenco);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_b16 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_HALL
|
||||||
|
/* Deinitialzie hall handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_b16(&motor->hall);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_b16 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
||||||
/* Deinitialize motor alignment routine */
|
/* Deinitialize motor alignment routine */
|
||||||
|
|
||||||
@ -1058,7 +1091,7 @@ int foc_motor_deinit(FAR struct foc_motor_b16_s *motor)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
||||||
/* Deinitialize motor identment routine */
|
/* Deinitialize motor identification routine */
|
||||||
|
|
||||||
ret = foc_routine_deinit_b16(&motor->ident);
|
ret = foc_routine_deinit_b16(&motor->ident);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -1033,6 +1033,39 @@ int foc_motor_deinit(FAR struct foc_motor_f32_s *motor)
|
|||||||
|
|
||||||
DEBUGASSERT(motor);
|
DEBUGASSERT(motor);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_OPENLOOP
|
||||||
|
/* Deinitialzie open-loop handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_f32(&motor->openloop);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_f32 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_QENCO
|
||||||
|
/* Deinitialzie qenco handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_f32(&motor->qenco);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_f32 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_HALL
|
||||||
|
/* Deinitialzie hall handler */
|
||||||
|
|
||||||
|
ret = foc_angle_deinit_f32(&motor->hall);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
PRINTFV("ERROR: foc_angle_deinit_f32 failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ALIGN
|
||||||
/* Deinitialize motor alignment routine */
|
/* Deinitialize motor alignment routine */
|
||||||
|
|
||||||
@ -1045,7 +1078,7 @@ int foc_motor_deinit(FAR struct foc_motor_f32_s *motor)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
|
||||||
/* Deinitialize motor identment routine */
|
/* Deinitialize motor identification routine */
|
||||||
|
|
||||||
ret = foc_routine_deinit_f32(&motor->ident);
|
ret = foc_routine_deinit_f32(&motor->ident);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user