mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
mavlink_orb_subscription: remove unneeded checks
not needed anymore after the previous commit
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user