examples/foc: add missing deinit calls
diff --git a/examples/foc/foc_motor_b16.c b/examples/foc/foc_motor_b16.c
index 6b3112a..2fe9dfd 100644
--- a/examples/foc/foc_motor_b16.c
+++ b/examples/foc/foc_motor_b16.c
@@ -1046,6 +1046,39 @@
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
/* Deinitialize motor alignment routine */
@@ -1058,7 +1091,7 @@
#endif
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
- /* Deinitialize motor identment routine */
+ /* Deinitialize motor identification routine */
ret = foc_routine_deinit_b16(&motor->ident);
if (ret < 0)
diff --git a/examples/foc/foc_motor_f32.c b/examples/foc/foc_motor_f32.c
index 733a2a0..ead7e56 100644
--- a/examples/foc/foc_motor_f32.c
+++ b/examples/foc/foc_motor_f32.c
@@ -1033,6 +1033,39 @@
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
/* Deinitialize motor alignment routine */
@@ -1045,7 +1078,7 @@
#endif
#ifdef CONFIG_EXAMPLES_FOC_HAVE_IDENT
- /* Deinitialize motor identment routine */
+ /* Deinitialize motor identification routine */
ret = foc_routine_deinit_f32(&motor->ident);
if (ret < 0)