From 97fe5f928a32ae8463f4a5e5ff92a7f5803abddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 16 Jul 2018 09:39:42 +0200 Subject: [PATCH] mavlink_orb_subscription: remove unneeded checks not needed anymore after the previous commit --- .../mavlink/mavlink_orb_subscription.cpp | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/modules/mavlink/mavlink_orb_subscription.cpp b/src/modules/mavlink/mavlink_orb_subscription.cpp index 7b13f6d1ba..4fdf3d2b99 100644 --- a/src/modules/mavlink/mavlink_orb_subscription.cpp +++ b/src/modules/mavlink/mavlink_orb_subscription.cpp @@ -119,21 +119,13 @@ MavlinkOrbSubscription::update(void *data) bool MavlinkOrbSubscription::update_if_changed(void *data) { - bool prevpub = _published; - if (!is_published()) { return false; } bool updated; - if (orb_check(_fd, &updated)) { - return false; - } - - // If we didn't update and this topic did not change - // its publication status then nothing really changed - if (!updated && prevpub == _published) { + if (orb_check(_fd, &updated) || !updated) { return false; } @@ -160,7 +152,7 @@ MavlinkOrbSubscription::is_published() // We don't want to subscribe to anything that does not exist // in order to save memory and file descriptors. // However, for some topics like vehicle_command_ack, we want to subscribe - // from the beginning in order not to miss the first publish respective advertise. + // from the beginning in order not to miss or delay the first publish respective advertise. if (!_subscribe_from_beginning && orb_exists(_topic, _instance)) { return false; } @@ -176,15 +168,6 @@ MavlinkOrbSubscription::is_published() _published = true; } - // topic may have been last published before we subscribed - uint64_t time_topic = 0; - - if (!_published && orb_stat(_fd, &time_topic) == PX4_OK) { - if (time_topic != 0) { - _published = true; - } - } - return _published; }