mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-11 03:01:35 +08:00
uORB: add bitset for faster orb_exists check and remove uORB::Subscription lazy subscribe hack/optimization
- add PX4 bitset and atomic_bitset with testing - add uORB::Subscription constructor to take ORB_ID enum - move orb test messages into msg/
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <uORB/uORBTopics.h>
|
||||
#include <uORB/topics/uORBTopics.hpp>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -297,9 +297,9 @@ bool LoggedTopics::add_topic(const orb_metadata *topic, uint16_t interval_ms, ui
|
||||
}
|
||||
|
||||
RequestedSubscription &sub = _subscriptions.sub[_subscriptions.count++];
|
||||
sub.topic = topic;
|
||||
sub.interval_ms = interval_ms;
|
||||
sub.instance = instance;
|
||||
sub.id = static_cast<ORB_ID>(topic->o_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ bool LoggedTopics::add_topic(const char *name, uint16_t interval_ms, uint8_t ins
|
||||
|
||||
// check if already added: if so, only update the interval
|
||||
for (int j = 0; j < _subscriptions.count; ++j) {
|
||||
if (_subscriptions.sub[j].topic == topics[i] &&
|
||||
if (_subscriptions.sub[j].id == static_cast<ORB_ID>(topics[i]->o_id) &&
|
||||
_subscriptions.sub[j].instance == instance) {
|
||||
|
||||
PX4_DEBUG("logging topic %s(%d), interval: %i, already added, only setting interval",
|
||||
|
||||
Reference in New Issue
Block a user