mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 19:20:35 +08:00
refactor orb: uORB::Manager is responsible for the DeviceMaster objects
This has the following benefits: - Manager can ensure that there is at most one instance of DeviceMaster per Flavor - The Manager needs access to (static) data of DeviceMaster already. This will make it easier to access this data in a non-static way, and does not introduce new dependencies.
This commit is contained in:
@@ -72,18 +72,10 @@ uorb_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* create the driver */
|
||||
g_dev = new uORB::DeviceMaster(uORB::PUBSUB);
|
||||
g_dev = uORB::Manager::get_instance()->get_device_master(uORB::PUBSUB);
|
||||
|
||||
if (g_dev == nullptr) {
|
||||
PX4_ERR("driver alloc failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (OK != g_dev->init()) {
|
||||
PX4_ERR("driver init failed");
|
||||
delete g_dev;
|
||||
g_dev = nullptr;
|
||||
return -EIO;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
Reference in New Issue
Block a user