mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 18:03:33 +08:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user