mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-27 10:20:35 +08:00
move initial sensor priority to parameters and purge ORB_PRIORITY
- CAL_ACCx_EN -> CAL_ACCx_PRIO - CAL_GYROx_EN -> CAL_GYROx_PRIO - CAL_MAGx_EN -> CAL_MAGx_PRIO
This commit is contained in:
@@ -59,23 +59,20 @@ public:
|
||||
* Constructor
|
||||
*
|
||||
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
|
||||
* @param priority The priority for multi pub/sub, 0 means don't publish as multi
|
||||
*/
|
||||
PublicationMulti(ORB_ID id, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
|
||||
PublicationBase(id),
|
||||
_priority(priority)
|
||||
PublicationMulti(ORB_ID id) :
|
||||
PublicationBase(id)
|
||||
{}
|
||||
|
||||
PublicationMulti(const orb_metadata *meta, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
|
||||
PublicationBase(static_cast<ORB_ID>(meta->o_id)),
|
||||
_priority(priority)
|
||||
PublicationMulti(const orb_metadata *meta) :
|
||||
PublicationBase(static_cast<ORB_ID>(meta->o_id))
|
||||
{}
|
||||
|
||||
bool advertise()
|
||||
{
|
||||
if (!advertised()) {
|
||||
int instance = 0;
|
||||
_handle = orb_advertise_multi_queue(get_topic(), nullptr, &instance, _priority, QSIZE);
|
||||
_handle = orb_advertise_multi_queue(get_topic(), nullptr, &instance, QSIZE);
|
||||
}
|
||||
|
||||
return advertised();
|
||||
@@ -93,9 +90,6 @@ public:
|
||||
|
||||
return (orb_publish(get_topic(), _handle, &data) == PX4_OK);
|
||||
}
|
||||
|
||||
protected:
|
||||
const ORB_PRIO _priority;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -109,14 +103,9 @@ public:
|
||||
* Constructor
|
||||
*
|
||||
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
|
||||
* @param priority The priority for multi pub
|
||||
*/
|
||||
PublicationMultiData(ORB_ID id, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
|
||||
PublicationMulti<T>(id, priority)
|
||||
{}
|
||||
PublicationMultiData(const orb_metadata *meta, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
|
||||
PublicationMulti<T>(meta, priority)
|
||||
{}
|
||||
PublicationMultiData(ORB_ID id) : PublicationMulti<T>(id) {}
|
||||
PublicationMultiData(const orb_metadata *meta) : PublicationMulti<T>(meta) {}
|
||||
|
||||
T &get() { return _data; }
|
||||
void set(const T &data) { _data = data; }
|
||||
|
||||
@@ -129,7 +129,6 @@ public:
|
||||
|
||||
uint8_t get_instance() const { return _instance; }
|
||||
unsigned get_last_generation() const { return _last_generation; }
|
||||
ORB_PRIO get_priority() { return advertised() ? _node->get_priority() : ORB_PRIO_UNINITIALIZED; }
|
||||
orb_id_t get_topic() const { return get_orb_meta(_orb_id); }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -137,7 +137,6 @@ public:
|
||||
uint8_t get_instance() const { return _subscription.get_instance(); }
|
||||
uint32_t get_interval_us() const { return _interval_us; }
|
||||
unsigned get_last_generation() const { return _subscription.get_last_generation(); }
|
||||
ORB_PRIO get_priority() { return _subscription.get_priority(); }
|
||||
orb_id_t get_topic() const { return _subscription.get_topic(); }
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,15 +50,15 @@ orb_advert_t orb_advertise_queue(const struct orb_metadata *meta, const void *da
|
||||
return uORB::Manager::get_instance()->orb_advertise(meta, data, queue_size);
|
||||
}
|
||||
|
||||
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, ORB_PRIO priority)
|
||||
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance)
|
||||
{
|
||||
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance, priority);
|
||||
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance);
|
||||
}
|
||||
|
||||
orb_advert_t orb_advertise_multi_queue(const struct orb_metadata *meta, const void *data, int *instance,
|
||||
ORB_PRIO priority, unsigned int queue_size)
|
||||
unsigned int queue_size)
|
||||
{
|
||||
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance, priority, queue_size);
|
||||
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance, queue_size);
|
||||
}
|
||||
|
||||
int orb_unadvertise(orb_advert_t handle)
|
||||
@@ -112,11 +112,6 @@ int orb_group_count(const struct orb_metadata *meta)
|
||||
return instance;
|
||||
}
|
||||
|
||||
int orb_priority(int handle, enum ORB_PRIO *priority)
|
||||
{
|
||||
return uORB::Manager::get_instance()->orb_priority(handle, priority);
|
||||
}
|
||||
|
||||
int orb_set_interval(int handle, unsigned interval)
|
||||
{
|
||||
return uORB::Manager::get_instance()->orb_set_interval(handle, interval);
|
||||
|
||||
+4
-25
@@ -62,21 +62,6 @@ typedef const struct orb_metadata *orb_id_t;
|
||||
*/
|
||||
#define ORB_MULTI_MAX_INSTANCES 4 // This must be < 10 (because it's the last char of the node path)
|
||||
|
||||
/**
|
||||
* Topic priority.
|
||||
* Relevant for multi-topics / topic groups
|
||||
*/
|
||||
enum ORB_PRIO {
|
||||
ORB_PRIO_UNINITIALIZED = 0,
|
||||
ORB_PRIO_MIN = 1,
|
||||
ORB_PRIO_VERY_LOW = 25,
|
||||
ORB_PRIO_LOW = 50,
|
||||
ORB_PRIO_DEFAULT = 75,
|
||||
ORB_PRIO_HIGH = 100,
|
||||
ORB_PRIO_VERY_HIGH = 125,
|
||||
ORB_PRIO_MAX = 255
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a pointer to the uORB metadata structure for
|
||||
* a given topic.
|
||||
@@ -151,14 +136,13 @@ extern orb_advert_t orb_advertise_queue(const struct orb_metadata *meta, const v
|
||||
/**
|
||||
* @see uORB::Manager::orb_advertise_multi()
|
||||
*/
|
||||
extern orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
|
||||
enum ORB_PRIO priority) __EXPORT;
|
||||
extern orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance) __EXPORT;
|
||||
|
||||
/**
|
||||
* @see uORB::Manager::orb_advertise_multi()
|
||||
*/
|
||||
extern orb_advert_t orb_advertise_multi_queue(const struct orb_metadata *meta, const void *data, int *instance,
|
||||
enum ORB_PRIO priority, unsigned int queue_size) __EXPORT;
|
||||
unsigned int queue_size) __EXPORT;
|
||||
|
||||
/**
|
||||
* @see uORB::Manager::orb_unadvertise()
|
||||
@@ -179,10 +163,10 @@ extern int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, con
|
||||
* @see uORB::Manager::orb_advertise_multi() for meaning of the individual parameters
|
||||
*/
|
||||
static inline int orb_publish_auto(const struct orb_metadata *meta, orb_advert_t *handle, const void *data,
|
||||
int *instance, enum ORB_PRIO priority)
|
||||
int *instance)
|
||||
{
|
||||
if (!*handle) {
|
||||
*handle = orb_advertise_multi(meta, data, instance, priority);
|
||||
*handle = orb_advertise_multi(meta, data, instance);
|
||||
|
||||
if (*handle) {
|
||||
return 0;
|
||||
@@ -233,11 +217,6 @@ extern int orb_exists(const struct orb_metadata *meta, int instance) __EXPORT;
|
||||
*/
|
||||
extern int orb_group_count(const struct orb_metadata *meta) __EXPORT;
|
||||
|
||||
/**
|
||||
* @see uORB::Manager::orb_priority()
|
||||
*/
|
||||
extern int orb_priority(int handle, enum ORB_PRIO *priority) __EXPORT;
|
||||
|
||||
/**
|
||||
* @see uORB::Manager::orb_set_interval()
|
||||
*/
|
||||
|
||||
@@ -47,7 +47,6 @@ static constexpr unsigned orb_maxpath = 64;
|
||||
struct orb_advertdata {
|
||||
const struct orb_metadata *meta;
|
||||
int *instance;
|
||||
ORB_PRIO priority;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ uORB::DeviceMaster::~DeviceMaster()
|
||||
px4_sem_destroy(&_lock);
|
||||
}
|
||||
|
||||
int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, ORB_PRIO priority)
|
||||
int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance)
|
||||
{
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
@@ -107,7 +107,7 @@ int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_adver
|
||||
}
|
||||
|
||||
/* construct the new node, passing the ownership of path to it */
|
||||
uORB::DeviceNode *node = new uORB::DeviceNode(meta, group_tries, devpath, priority);
|
||||
uORB::DeviceNode *node = new uORB::DeviceNode(meta, group_tries, devpath);
|
||||
|
||||
/* if we didn't get a device, that's bad, free the path too */
|
||||
if (node == nullptr) {
|
||||
@@ -142,7 +142,6 @@ int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_adver
|
||||
if (existing_node != nullptr &&
|
||||
(!existing_node->is_advertised() || is_single_instance_advertiser || !is_advertiser)) {
|
||||
if (is_advertiser) {
|
||||
existing_node->set_priority((ORB_PRIO)priority);
|
||||
/* Set as advertised to avoid race conditions (otherwise 2 multi-instance advertisers
|
||||
* could get the same instance).
|
||||
*/
|
||||
@@ -194,7 +193,7 @@ void uORB::DeviceMaster::printStatistics()
|
||||
return;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("%-*s INST #SUB #Q SIZE PRIO PATH\n", (int)max_topic_name_length - 2, "TOPIC NAME");
|
||||
PX4_INFO_RAW("%-*s INST #SUB #Q SIZE PATH\n", (int)max_topic_name_length - 2, "TOPIC NAME");
|
||||
|
||||
cur_node = first_node;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class uORB::DeviceMaster
|
||||
{
|
||||
public:
|
||||
|
||||
int advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, ORB_PRIO priority);
|
||||
int advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance);
|
||||
|
||||
/**
|
||||
* Public interface for getDeviceNodeLocked(). Takes care of synchronization.
|
||||
|
||||
@@ -45,10 +45,9 @@
|
||||
static uORB::SubscriptionInterval *filp_to_subscription(cdev::file_t *filp) { return static_cast<uORB::SubscriptionInterval *>(filp->f_priv); }
|
||||
|
||||
uORB::DeviceNode::DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path,
|
||||
ORB_PRIO priority, uint8_t queue_size) :
|
||||
uint8_t queue_size) :
|
||||
CDev(path),
|
||||
_meta(meta),
|
||||
_priority(priority),
|
||||
_instance(instance),
|
||||
_queue_size(queue_size)
|
||||
{
|
||||
@@ -251,10 +250,6 @@ uORB::DeviceNode::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
*(uintptr_t *)arg = (uintptr_t)this;
|
||||
return PX4_OK;
|
||||
|
||||
case ORBIOCGPRIORITY:
|
||||
*(int *)arg = get_priority();
|
||||
return PX4_OK;
|
||||
|
||||
case ORBIOCSETQUEUESIZE: {
|
||||
lock();
|
||||
int ret = update_queue_size(arg);
|
||||
@@ -351,7 +346,7 @@ int uORB::DeviceNode::unadvertise(orb_advert_t handle)
|
||||
}
|
||||
|
||||
#ifdef ORB_COMMUNICATOR
|
||||
int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta, ORB_PRIO priority)
|
||||
int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta)
|
||||
{
|
||||
uORBCommunicator::IChannel *ch = uORB::Manager::get_instance()->get_uorb_communicator();
|
||||
|
||||
@@ -364,7 +359,7 @@ int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta, ORB_PRIO pr
|
||||
|
||||
/*
|
||||
//TODO: Check if we need this since we only unadvertise when things all shutdown and it doesn't actually remove the device
|
||||
int16_t uORB::DeviceNode::topic_unadvertised(const orb_metadata *meta, ORB_PRIO priority)
|
||||
int16_t uORB::DeviceNode::topic_unadvertised(const orb_metadata *meta)
|
||||
{
|
||||
uORBCommunicator::IChannel *ch = uORB::Manager::get_instance()->get_uorb_communicator();
|
||||
if (ch != nullptr && meta != nullptr) {
|
||||
@@ -401,14 +396,13 @@ uORB::DeviceNode::print_statistics(int max_topic_length)
|
||||
lock();
|
||||
|
||||
const uint8_t instance = get_instance();
|
||||
const uint8_t priority = get_priority();
|
||||
const int8_t sub_count = subscriber_count();
|
||||
const uint8_t queue_size = get_queue_size();
|
||||
|
||||
unlock();
|
||||
|
||||
PX4_INFO_RAW("%-*s %2i %4i %2i %4i %4i %s\n", max_topic_length, get_meta()->o_name, (int)instance, (int)sub_count,
|
||||
queue_size, get_meta()->o_size, priority, get_devname());
|
||||
PX4_INFO_RAW("%-*s %2i %4i %2i %4i %s\n", max_topic_length, get_meta()->o_name, (int)instance, (int)sub_count,
|
||||
queue_size, get_meta()->o_size, get_devname());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,7 @@ class SubscriptionCallback;
|
||||
class uORB::DeviceNode : public cdev::CDev, public IntrusiveSortedListNode<uORB::DeviceNode *>
|
||||
{
|
||||
public:
|
||||
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, ORB_PRIO priority,
|
||||
uint8_t queue_size = 1);
|
||||
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, uint8_t queue_size = 1);
|
||||
virtual ~DeviceNode();
|
||||
|
||||
// no copy, assignment, move, move assignment
|
||||
@@ -119,8 +118,8 @@ public:
|
||||
static int unadvertise(orb_advert_t handle);
|
||||
|
||||
#ifdef ORB_COMMUNICATOR
|
||||
static int16_t topic_advertised(const orb_metadata *meta, ORB_PRIO priority);
|
||||
//static int16_t topic_unadvertised(const orb_metadata *meta, ORB_PRIO priority);
|
||||
static int16_t topic_advertised(const orb_metadata *meta);
|
||||
//static int16_t topic_unadvertised(const orb_metadata *meta);
|
||||
|
||||
/**
|
||||
* processes a request for add subscription from remote
|
||||
@@ -199,9 +198,6 @@ public:
|
||||
|
||||
uint8_t get_instance() const { return _instance; }
|
||||
|
||||
ORB_PRIO get_priority() const { return (ORB_PRIO)_priority; }
|
||||
void set_priority(ORB_PRIO priority) { _priority = priority; }
|
||||
|
||||
/**
|
||||
* Copies data and the corresponding generation
|
||||
* from a node to the buffer provided.
|
||||
@@ -235,7 +231,6 @@ private:
|
||||
px4::atomic<unsigned> _generation{0}; /**< object generation count */
|
||||
List<uORB::SubscriptionCallback *> _callbacks;
|
||||
|
||||
ORB_PRIO _priority; /**< priority of the topic */
|
||||
const uint8_t _instance; /**< orb multi instance identifier */
|
||||
bool _advertised{false}; /**< has ever been advertised (not necessarily published data yet) */
|
||||
uint8_t _queue_size; /**< maximum number of elements in the queue */
|
||||
|
||||
@@ -168,7 +168,7 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance)
|
||||
}
|
||||
|
||||
orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
|
||||
ORB_PRIO priority, unsigned int queue_size)
|
||||
unsigned int queue_size)
|
||||
{
|
||||
#ifdef ORB_USE_PUBLISHER_RULES
|
||||
|
||||
@@ -195,7 +195,7 @@ orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta,
|
||||
#endif /* ORB_USE_PUBLISHER_RULES */
|
||||
|
||||
/* open the node as an advertiser */
|
||||
int fd = node_open(meta, true, instance, priority);
|
||||
int fd = node_open(meta, true, instance);
|
||||
|
||||
if (fd == PX4_ERROR) {
|
||||
PX4_ERR("%s advertise failed (%i)", meta->o_name, errno);
|
||||
@@ -224,7 +224,7 @@ orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta,
|
||||
|
||||
#ifdef ORB_COMMUNICATOR
|
||||
// For remote systems call over and inform them
|
||||
uORB::DeviceNode::topic_advertised(meta, priority);
|
||||
uORB::DeviceNode::topic_advertised(meta);
|
||||
#endif /* ORB_COMMUNICATOR */
|
||||
|
||||
/* the advertiser may perform an initial publish to initialise the object */
|
||||
@@ -307,11 +307,6 @@ int uORB::Manager::orb_check(int handle, bool *updated)
|
||||
return px4_ioctl(handle, ORBIOCUPDATED, (unsigned long)(uintptr_t)updated);
|
||||
}
|
||||
|
||||
int uORB::Manager::orb_priority(int handle, enum ORB_PRIO *priority)
|
||||
{
|
||||
return px4_ioctl(handle, ORBIOCGPRIORITY, (unsigned long)(uintptr_t)priority);
|
||||
}
|
||||
|
||||
int uORB::Manager::orb_set_interval(int handle, unsigned interval)
|
||||
{
|
||||
return px4_ioctl(handle, ORBIOCSETINTERVAL, interval * 1000);
|
||||
@@ -324,7 +319,7 @@ int uORB::Manager::orb_get_interval(int handle, unsigned *interval)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, int *instance, ORB_PRIO priority)
|
||||
int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, int *instance)
|
||||
{
|
||||
char path[orb_maxpath];
|
||||
int fd = -1;
|
||||
@@ -365,7 +360,7 @@ int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, i
|
||||
ret = PX4_ERROR;
|
||||
|
||||
if (get_device_master()) {
|
||||
ret = _device_master->advertise(meta, advertiser, instance, priority);
|
||||
ret = _device_master->advertise(meta, advertiser, instance);
|
||||
}
|
||||
|
||||
/* it's OK if it already exists */
|
||||
|
||||
@@ -106,8 +106,7 @@ public:
|
||||
* Any number of advertisers may publish to a topic; publications are atomic
|
||||
* but co-ordination between publishers is not provided by the ORB.
|
||||
*
|
||||
* Internally this will call orb_advertise_multi with an instance of 0 and
|
||||
* default priority.
|
||||
* Internally this will call orb_advertise_multi with an instance of 0.
|
||||
*
|
||||
* @param meta The uORB metadata (usually from the ORB_ID() macro)
|
||||
* for the topic.
|
||||
@@ -124,7 +123,7 @@ public:
|
||||
*/
|
||||
orb_advert_t orb_advertise(const struct orb_metadata *meta, const void *data, unsigned int queue_size = 1)
|
||||
{
|
||||
return orb_advertise_multi(meta, data, nullptr, ORB_PRIO_DEFAULT, queue_size);
|
||||
return orb_advertise_multi(meta, data, nullptr, queue_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,10 +148,6 @@ public:
|
||||
* @param instance Pointer to an integer which will yield the instance ID (0-based)
|
||||
* of the publication. This is an output parameter and will be set to the newly
|
||||
* created instance, ie. 0 for the first advertiser, 1 for the next and so on.
|
||||
* @param priority The priority of the instance. If a subscriber subscribes multiple
|
||||
* instances, the priority allows the subscriber to prioritize the best
|
||||
* data source as long as its available. The subscriber is responsible to check
|
||||
* and handle different priorities (@see orb_priority()).
|
||||
* @param queue_size Maximum number of buffered elements. If this is 1, no queuing is
|
||||
* used.
|
||||
* @return PX4_ERROR on error, otherwise returns a handle
|
||||
@@ -161,7 +156,7 @@ public:
|
||||
* ORB_DEFINE with no corresponding ORB_DECLARE)
|
||||
* this function will return -1 and set errno to ENOENT.
|
||||
*/
|
||||
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, ORB_PRIO priority,
|
||||
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
|
||||
unsigned int queue_size = 1);
|
||||
|
||||
/**
|
||||
@@ -308,18 +303,6 @@ public:
|
||||
*/
|
||||
int orb_exists(const struct orb_metadata *meta, int instance);
|
||||
|
||||
/**
|
||||
* Return the priority of the topic
|
||||
*
|
||||
* @param handle A handle returned from orb_subscribe.
|
||||
* @param priority Returns the priority of this topic. This is only relevant for
|
||||
* topics which are published by multiple publishers (e.g. mag0, mag1, etc.)
|
||||
* and allows a subscriber to pick the topic with the highest priority,
|
||||
* independent of the startup order of the associated publishers.
|
||||
* @return OK on success, PX4_ERROR otherwise with errno set accordingly.
|
||||
*/
|
||||
int orb_priority(int handle, enum ORB_PRIO *priority);
|
||||
|
||||
/**
|
||||
* Set the minimum interval between which updates are seen for a subscription.
|
||||
*
|
||||
@@ -383,8 +366,7 @@ private: // class methods
|
||||
* Handles creation of the object and the initial publication for
|
||||
* advertisers.
|
||||
*/
|
||||
int node_open(const struct orb_metadata *meta, bool advertiser, int *instance = nullptr,
|
||||
ORB_PRIO priority = ORB_PRIO_DEFAULT);
|
||||
int node_open(const struct orb_metadata *meta, bool advertiser, int *instance = nullptr);
|
||||
|
||||
private: // data members
|
||||
static Manager *_Instance;
|
||||
|
||||
@@ -229,7 +229,7 @@ int uORBTest::UnitTest::test_unadvertise()
|
||||
orb_test_s t{};
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
_pfd[i] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance_test[i], ORB_PRIO_MAX);
|
||||
_pfd[i] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance_test[i]);
|
||||
|
||||
if (instance_test[i] != i) {
|
||||
return test_fail("got wrong instance (should be %i, is %i)", i, instance_test[i]);
|
||||
@@ -335,12 +335,12 @@ int uORBTest::UnitTest::test_multi()
|
||||
orb_test_s u{};
|
||||
|
||||
int instance0;
|
||||
_pfd[0] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance0, ORB_PRIO_MAX);
|
||||
_pfd[0] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance0);
|
||||
|
||||
test_note("advertised");
|
||||
|
||||
int instance1;
|
||||
_pfd[1] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance1, ORB_PRIO_MIN);
|
||||
_pfd[1] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance1);
|
||||
|
||||
if (instance0 != 0) {
|
||||
return test_fail("mult. id0: %d", instance0);
|
||||
@@ -385,25 +385,6 @@ int uORBTest::UnitTest::test_multi()
|
||||
return test_fail("sub #1 val. mismatch: %d", u.val);
|
||||
}
|
||||
|
||||
/* test priorities */
|
||||
ORB_PRIO prio;
|
||||
|
||||
if (PX4_OK != orb_priority(sfd0, &prio)) {
|
||||
return test_fail("prio #0");
|
||||
}
|
||||
|
||||
if (prio != ORB_PRIO_MAX) {
|
||||
return test_fail("prio: %d", prio);
|
||||
}
|
||||
|
||||
if (PX4_OK != orb_priority(sfd1, &prio)) {
|
||||
return test_fail("prio #1");
|
||||
}
|
||||
|
||||
if (prio != ORB_PRIO_MIN) {
|
||||
return test_fail("prio: %d", prio);
|
||||
}
|
||||
|
||||
if (PX4_OK != latency_test<orb_test_s>(ORB_ID(orb_test), false)) {
|
||||
return test_fail("latency test failed");
|
||||
}
|
||||
@@ -431,7 +412,7 @@ int uORBTest::UnitTest::pub_test_multi2_main()
|
||||
orb_advert_t &pub = orb_pub[i];
|
||||
int idx = i;
|
||||
// PX4_WARN("advertise %i, t=%" PRIu64, i, hrt_absolute_time());
|
||||
pub = orb_advertise_multi(ORB_ID(orb_test_medium_multi), &data_topic, &idx, ORB_PRIO_DEFAULT);
|
||||
pub = orb_advertise_multi(ORB_ID(orb_test_medium_multi), &data_topic, &idx);
|
||||
|
||||
if (idx != i) {
|
||||
_thread_should_exit = true;
|
||||
@@ -550,12 +531,10 @@ int uORBTest::UnitTest::test_multi_reversed()
|
||||
t.val = 0;
|
||||
|
||||
int instance2;
|
||||
|
||||
_pfd[2] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance2, ORB_PRIO_MAX);
|
||||
_pfd[2] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance2);
|
||||
|
||||
int instance3;
|
||||
|
||||
_pfd[3] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance3, ORB_PRIO_MIN);
|
||||
_pfd[3] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance3);
|
||||
|
||||
test_note("advertised");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user