From 86fa1add107f6e8de5b3ed12f8f2b772b5ae4a39 Mon Sep 17 00:00:00 2001 From: Jeff Kletsky Date: Thu, 8 Feb 2018 20:56:38 -0800 Subject: [PATCH] extras/sntp: SNTP_LOGD_WITH_PRINTF enables logging Can continue to define own SNTP_LOGD --- extras/sntp/component.mk | 5 +++++ extras/sntp/sntp_fun.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/extras/sntp/component.mk b/extras/sntp/component.mk index 155537a..dc0ee5c 100644 --- a/extras/sntp/component.mk +++ b/extras/sntp/component.mk @@ -5,4 +5,9 @@ INC_DIRS += $(sntp_ROOT) # args for passing into compile rule generation sntp_SRC_DIR = $(sntp_ROOT) +# For SNTP logging, either supply own SNTP_LOGD +# or define SNTP_LOGD_WITH_PRINTF (see sntp_fun.c) + +# sntp_CFLAGS = $(CFLAGS) -DSNTP_LOGD_WITH_PRINTF + $(eval $(call component_compile_rules,sntp)) diff --git a/extras/sntp/sntp_fun.c b/extras/sntp/sntp_fun.c index a5e77f6..66956ca 100644 --- a/extras/sntp/sntp_fun.c +++ b/extras/sntp/sntp_fun.c @@ -14,7 +14,11 @@ #include #include -// #define SNTP_LOGD(FMT, ...) printf(FMT "\n", ##__VA_ARGS__) + +#ifdef SNTP_LOGD_WITH_PRINTF +#define SNTP_LOGD(FMT, ...) printf(FMT "\n", ##__VA_ARGS__) +#endif + #ifndef SNTP_LOGD #define SNTP_LOGD(...) #define SKIP_DIAGNOSTICS