From 83d97fd1c27728145e4869f957afcc7cae57ff8a Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Thu, 4 Dec 2014 09:53:37 +0100 Subject: [PATCH] better support for param default values on ros and px4 --- src/examples/subscriber/subscriber_params.c | 4 ++-- src/examples/subscriber/subscriber_params.h | 4 ++-- src/platforms/px4_defines.h | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/examples/subscriber/subscriber_params.c b/src/examples/subscriber/subscriber_params.c index 0d36f5021d..a43817b5b9 100644 --- a/src/examples/subscriber/subscriber_params.c +++ b/src/examples/subscriber/subscriber_params.c @@ -46,11 +46,11 @@ * * @group Subscriber Example */ -PARAM_DEFINE_INT32(SUB_INTERV, PX4_PARAM_DEFAULT_VALUE_NAME(SUB_INTERV)); +PX4_PARAM_DEFINE_INT32(SUB_INTERV); /** * Float Demonstration Parameter in the Example * * @group Subscriber Example */ -PARAM_DEFINE_FLOAT(SUB_TESTF, PX4_PARAM_DEFAULT_VALUE_NAME(SUB_TESTF)); +PX4_PARAM_DEFINE_FLOAT(SUB_TESTF); diff --git a/src/examples/subscriber/subscriber_params.h b/src/examples/subscriber/subscriber_params.h index 3f3ff5bce8..f6f1d6ba0c 100644 --- a/src/examples/subscriber/subscriber_params.h +++ b/src/examples/subscriber/subscriber_params.h @@ -39,5 +39,5 @@ */ #pragma once -#define SUB_INTERV_DEFAULT_VALUE 100 -#define SUB_TESTF_DEFAULT_VALUE 3.14f +#define PARAM_SUB_INTERV_DEFAULT 100 +#define PARAM_SUB_TESTF_DEFAULT 3.14f diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index 6760f57ead..09338acabf 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -39,7 +39,9 @@ #pragma once -#define PX4_PARAM_DEFAULT_VALUE_NAME(_name) _name##_DEFAULT_VALUE +#define PX4_PARAM_DEFAULT_VALUE_NAME(_name) PARAM_##_name##_DEFAULT +#define PX4_PARAM_DEFINE_INT32(_name) PARAM_DEFINE_INT32(_name, PX4_PARAM_DEFAULT_VALUE_NAME(_name)) +#define PX4_PARAM_DEFINE_FLOAT(_name) PARAM_DEFINE_FLOAT(_name, PX4_PARAM_DEFAULT_VALUE_NAME(_name)) #if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))