1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-432 Automatically generate -DHAS_xxx_MODULE for *all* included modules. Use HAS_LOGGING_MODULE inside telemetry.c/setLoggingPeriod() to void function if logging module is not included.

This commit is contained in:
Vladimir Zidar 2017-10-07 15:30:18 +02:00
parent d9cce5e0d9
commit ed1f6881e3
2 changed files with 13 additions and 0 deletions

View File

@ -169,6 +169,10 @@ MODNAMES := $(notdir $(subst /revolution,,$(MODULES)))
MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell echo $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN)
CDEFS += $(MODULES_BUILTIN)
MODNAMES_ALL := $(notdir $(subst /revolution,,$(OPTMODULES) $(MODULES)))
MODULES_ALL := $(foreach mod, $(MODNAMES_ALL), -DHAS_$(shell echo $(mod) | tr '[:lower:]' '[:upper:]')_MODULE)
CDEFS += $(MODULES_ALL)
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
# Use file-extension c for "c-only"-files
SRCARM +=

View File

@ -777,6 +777,7 @@ static int32_t setLoggingPeriod(
UAVObjHandle obj,
int32_t updatePeriodMs)
{
#ifdef HAS_LOGGING_MODULE
UAVObjEvent ev;
int32_t ret;
@ -798,6 +799,14 @@ static int32_t setLoggingPeriod(
ret = EventPeriodicQueueCreate(&ev, targetQueue, updatePeriodMs);
}
return ret;
#else /* HAS_LOGGING_MODULE */
(void)channel;
(void)obj;
(void)updatePeriodMs;
return 0;
#endif /* ifdef HAS_LOGGING_MODULE */
}
/**