Subscription & SubscriptionArray: add forcedUpdate() methods

Can be used to immediately get & use the data, as needed for the flight
tasks.
This commit is contained in:
Beat Küng
2018-04-05 07:30:12 +02:00
parent 071b09c65d
commit 737f7df6b8
4 changed files with 28 additions and 4 deletions
+2
View File
@@ -151,6 +151,8 @@ public:
return -3;
}
_subscription_array.forcedUpdate(); // make sure data is available for all new subscriptions
_current_task_index = task_number;
return 0;
}
@@ -76,3 +76,10 @@ void SubscriptionArray::update()
_subscriptions[i]->update();
}
}
void SubscriptionArray::forcedUpdate()
{
for (int i = 0; i < _subscriptions_count; ++i) {
_subscriptions[i]->forcedUpdate();
}
}
+6 -1
View File
@@ -60,10 +60,15 @@ public:
bool get(const struct orb_metadata *meta, uORB::Subscription<T> *&subscription, unsigned instance = 0);
/**
* update all subscriptions
* update all subscriptions (if new data is available)
*/
void update();
/**
* update all subscriptions
*/
void forcedUpdate();
private:
void cleanup();