uorb subscription: remove _interval & use orb_get_interval() instead

This commit is contained in:
Beat Küng
2016-08-12 08:58:33 +02:00
parent 6b4c24fb12
commit aefd217fc0
2 changed files with 14 additions and 13 deletions
+5 -5
View File
@@ -84,7 +84,7 @@ SubscriptionBase::SubscriptionBase(const struct orb_metadata *meta,
_handle = orb_subscribe(getMeta());
}
if (_handle < 0) { warnx("sub failed"); }
if (_handle < 0) { PX4_ERR("sub failed"); }
if (interval > 0) {
orb_set_interval(getHandle(), interval);
@@ -96,7 +96,7 @@ bool SubscriptionBase::updated()
bool isUpdated = false;
int ret = orb_check(_handle, &isUpdated);
if (ret != PX4_OK) { warnx("orb check failed"); }
if (ret != PX4_OK) { PX4_ERR("orb check failed"); }
return isUpdated;
}
@@ -106,7 +106,7 @@ void SubscriptionBase::update(void *data)
if (updated()) {
int ret = orb_copy(_meta, _handle, data);
if (ret != PX4_OK) { warnx("orb copy failed"); }
if (ret != PX4_OK) { PX4_ERR("orb copy failed"); }
}
}
@@ -114,7 +114,7 @@ SubscriptionBase::~SubscriptionBase()
{
int ret = orb_unsubscribe(_handle);
if (ret != PX4_OK) { warnx("orb unsubscribe failed"); }
if (ret != PX4_OK) { PX4_ERR("orb unsubscribe failed"); }
}
template <class T>
@@ -129,7 +129,7 @@ Subscription<T>::Subscription(const struct orb_metadata *meta,
template <class T>
Subscription<T>::Subscription(const Subscription &other) :
SubscriptionNode(other._meta, other._interval, other._instance, nullptr),
SubscriptionNode(other._meta, other.getInterval(), other._instance, nullptr),
_data() // initialize data structure to zero
{
}