aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/px4_subscriber.h
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-11-28 16:30:12 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-11-28 16:30:12 +0100
commit9abc8e26b789af0ef132c5c38e3d8ada821c3657 (patch)
treeadc3791edcc01a9c79d37cb7ec20ce050a483852 /src/platforms/px4_subscriber.h
parenta9c1e4ad6145485805366fad5c08ae7351886ff3 (diff)
downloadpx4-firmware-9abc8e26b789af0ef132c5c38e3d8ada821c3657.tar.gz
px4-firmware-9abc8e26b789af0ef132c5c38e3d8ada821c3657.tar.bz2
px4-firmware-9abc8e26b789af0ef132c5c38e3d8ada821c3657.zip
correctly handle interval, call callback only when topic updated, add example for 2 topics
Diffstat (limited to 'src/platforms/px4_subscriber.h')
-rw-r--r--src/platforms/px4_subscriber.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/platforms/px4_subscriber.h b/src/platforms/px4_subscriber.h
index efec8f2a3..6e0ef8aed 100644
--- a/src/platforms/px4_subscriber.h
+++ b/src/platforms/px4_subscriber.h
@@ -89,6 +89,11 @@ public:
~SubscriberPX4() {};
void update() {
+ if (!uORB::Subscription<M>::updated()) {
+ /* Topic not updated, do not call callback */
+ return;
+ }
+
/* get latest data */
uORB::Subscription<M>::update();