diff --git a/src/examples/publisher/publisher.cpp b/src/examples/publisher/publisher.cpp index 68fd8a5c3f..5ee8b459bc 100644 --- a/src/examples/publisher/publisher.cpp +++ b/src/examples/publisher/publisher.cpp @@ -32,7 +32,11 @@ using namespace px4; /** * This tutorial demonstrates simple sending of messages over the PX4 middleware system. */ -// __EXPORT bool task_should_exit; + +namespace px4 +{ +bool task_should_exit = false; +} PX4_MAIN_FUNCTION(publisher) { diff --git a/src/examples/subscriber/subscriber.cpp b/src/examples/subscriber/subscriber.cpp index cdadaf2bcd..b872318809 100644 --- a/src/examples/subscriber/subscriber.cpp +++ b/src/examples/subscriber/subscriber.cpp @@ -36,8 +36,10 @@ void rc_channels_callback(const PX4_TOPIC_T(rc_channels) *msg) { PX4_INFO("I heard: [%lu]", msg->timestamp_last_valid); } - -// __EXPORT bool task_should_exit; +namespace px4 +{ +bool task_should_exit = false; +} PX4_MAIN_FUNCTION(subscriber) { diff --git a/src/platforms/nuttx/px4_nodehandle.cpp b/src/platforms/nuttx/px4_nodehandle.cpp index 473a5cf777..091b5c6c69 100644 --- a/src/platforms/nuttx/px4_nodehandle.cpp +++ b/src/platforms/nuttx/px4_nodehandle.cpp @@ -37,3 +37,8 @@ * PX4 Middleware Wrapper Nodehandle */ #include + +namespace px4 +{ +bool task_should_exit = false; +} diff --git a/src/platforms/nuttx/px4_nuttx_impl.cpp b/src/platforms/nuttx/px4_nuttx_impl.cpp index 4b87f68fee..6471e3e380 100644 --- a/src/platforms/nuttx/px4_nuttx_impl.cpp +++ b/src/platforms/nuttx/px4_nuttx_impl.cpp @@ -40,7 +40,6 @@ #include #include -extern bool task_should_exit; namespace px4 { @@ -57,9 +56,7 @@ uint64_t get_time_micros() bool ok() { - // return !task_should_exit; - //XXX - return true; + return !task_should_exit; } void spin_once() diff --git a/src/platforms/px4_middleware.h b/src/platforms/px4_middleware.h index eebfc9049f..a09d9ac580 100644 --- a/src/platforms/px4_middleware.h +++ b/src/platforms/px4_middleware.h @@ -68,6 +68,8 @@ private: }; +extern bool task_should_exit; + // /** // * A limiter/ saturation. // * The output of update is the input, bounded