mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 16:13:34 +08:00
uORB: correct pub creation for multi-topics
This commit is contained in:
@@ -599,13 +599,6 @@ ORBDevMaster::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* driver wants a permanent copy of the node name, so make one here */
|
|
||||||
objname = strdup(meta->o_name);
|
|
||||||
|
|
||||||
if (objname == nullptr) {
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ensure that only one advertiser runs through this critical section */
|
/* ensure that only one advertiser runs through this critical section */
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
@@ -622,9 +615,20 @@ ORBDevMaster::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
*(adv->instance) = group_tries;
|
*(adv->instance) = group_tries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* driver wants a permanent copy of the node name, so make one here */
|
||||||
|
objname = strdup(meta->o_name);
|
||||||
|
|
||||||
|
if (objname == nullptr) {
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* driver wants a permanent copy of the path, so make one here */
|
/* driver wants a permanent copy of the path, so make one here */
|
||||||
devpath = strdup(nodepath);
|
devpath = strdup(nodepath);
|
||||||
|
|
||||||
|
if (devpath == nullptr) {
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* construct the new node */
|
/* construct the new node */
|
||||||
node = new ORBDevNode(meta, objname, devpath, adv->priority);
|
node = new ORBDevNode(meta, objname, devpath, adv->priority);
|
||||||
|
|
||||||
@@ -644,12 +648,11 @@ ORBDevMaster::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
free((void *)devpath);
|
free((void *)devpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try with next larger index */
|
|
||||||
group_tries++;
|
group_tries++;
|
||||||
|
|
||||||
} while (ret != OK && (group_tries < max_group_tries));
|
} while (ret != OK && (group_tries < max_group_tries));
|
||||||
|
|
||||||
if (group_tries >= max_group_tries) {
|
if (group_tries > max_group_tries) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ typedef const struct orb_metadata *orb_id_t;
|
|||||||
/**
|
/**
|
||||||
* Maximum number of multi topic instances
|
* Maximum number of multi topic instances
|
||||||
*/
|
*/
|
||||||
#define ORB_MULTI_MAX_INSTANCES 4
|
#define ORB_MULTI_MAX_INSTANCES 3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Topic priority.
|
* Topic priority.
|
||||||
|
|||||||
Reference in New Issue
Block a user