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


The following commit(s) were added to refs/heads/master by this push:
     new 57f98ee20 industrial/foc: add options to configure foclib logs
57f98ee20 is described below

commit 57f98ee20ec6ebc4aaf04673d8fad3a57325af56
Author: raiden00pl <raide...@railab.me>
AuthorDate: Tue Oct 31 18:43:33 2023 +0100

    industrial/foc: add options to configure foclib logs
---
 include/industry/foc/foc_log.h | 20 +++++++++++++++++---
 industry/foc/Kconfig           | 12 ++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/include/industry/foc/foc_log.h b/include/industry/foc/foc_log.h
index 0634d4924..bc8b1c43f 100644
--- a/include/industry/foc/foc_log.h
+++ b/include/industry/foc/foc_log.h
@@ -35,8 +35,22 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define FOCLIBLOG(format, ...)  printf(format, ##__VA_ARGS__)
-#define FOCLIBERR(format, ...)  printf(format, ##__VA_ARGS__)
-#define FOCLIBWARN(format, ...) printf(format, ##__VA_ARGS__)
+#ifdef CONFIG_INDUSTRY_FOC_DEBUG
+#  define FOCLIBLOG(format, ...)  printf(format, ##__VA_ARGS__)
+#else
+#  define FOCLIBLOG(format, ...)
+#endif
+
+#ifdef CONFIG_INDUSTRY_FOC_ERROR
+#  define FOCLIBERR(format, ...)  printf(format, ##__VA_ARGS__)
+#else
+#  define FOCLIBERR(format, ...)
+#endif
+
+#ifdef CONFIG_INDUSTRY_FOC_WARN
+#  define FOCLIBWARN(format, ...) printf(format, ##__VA_ARGS__)
+#else
+#  define FOCLIBWARN(format, ...)
+#endif
 
 #endif /* __APPS_INCLUDE_INDUSTRY_FOC_FOC_LOG_H */
diff --git a/industry/foc/Kconfig b/industry/foc/Kconfig
index c22356cec..9031c751e 100644
--- a/industry/foc/Kconfig
+++ b/industry/foc/Kconfig
@@ -12,6 +12,18 @@ config INDUSTRY_FOC
 
 if INDUSTRY_FOC
 
+config INDUSTRY_FOC_DEBUG
+       bool "Enable FOCLIB debug log"
+       default n
+
+config INDUSTRY_FOC_ERROR
+       bool "Enable FOCLIB error log"
+       default n
+
+config INDUSTRY_FOC_WARN
+       bool "Enable FOCLIB warn log"
+       default n
+
 config INDUSTRY_FOC_CORDIC
        bool "Enable CORDIC support"
        default n

Reply via email to