From 6b695ac9e8be9e7fe480238c967316366cba444c Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Fri, 28 Nov 2014 23:14:50 +0100 Subject: [PATCH] add PX4 advertise macro --- src/examples/publisher/publisher.cpp | 2 +- src/platforms/px4_defines.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/examples/publisher/publisher.cpp b/src/examples/publisher/publisher.cpp index 5c7156c08e..8ef147493f 100644 --- a/src/examples/publisher/publisher.cpp +++ b/src/examples/publisher/publisher.cpp @@ -62,7 +62,7 @@ PX4_MAIN_FUNCTION(publisher) * than we can send them, the number here specifies how many messages to * buffer up before throwing some away. */ - px4::Publisher * rc_channels_pub = n.advertise(PX4_TOPIC(rc_channels)); + px4::Publisher * rc_channels_pub = PX4_ADVERTISE(n, rc_channels); px4::Rate loop_rate(10); diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index f6679d01b1..84e5c8da09 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -69,3 +69,4 @@ /* Overload the PX4_SUBSCRIBE macro to suppport methods and pure functions as callback */ #define PX4_GET_SUBSCRIBE(_1, _2, _3, _4, _5, NAME, ...) NAME #define PX4_SUBSCRIBE(...) PX4_GET_SUBSCRIBE(__VA_ARGS__, PX4_SUBSCRIBE_CBMETH, PX4_SUBSCRIBE_CBFUNC)(__VA_ARGS__) +#define PX4_ADVERTISE(_nodehandle, _name) _nodehandle.advertise(PX4_TOPIC(_name))